@@ -145,30 +145,44 @@ namespace NKikimr::NStorage {
145
145
}
146
146
}
147
147
148
- for (const auto & [nodeId, sessionId ] : SubscribedSessions) {
148
+ for (const auto & [nodeId, subs ] : SubscribedSessions) {
149
149
bool okay = false ;
150
150
if (Binding && Binding->NodeId == nodeId) {
151
- Y_ABORT_UNLESS (sessionId == Binding->SessionId );
151
+ Y_VERIFY_S (subs.SessionId == Binding->SessionId || !Binding->SessionId ,
152
+ " Binding# " << Binding->ToString () << " Subscription# " << subs.ToString ());
152
153
okay = true ;
153
154
}
154
155
if (const auto it = DirectBoundNodes.find (nodeId); it != DirectBoundNodes.end ()) {
155
- Y_ABORT_UNLESS (!sessionId || sessionId == it->second .SessionId );
156
+ Y_VERIFY_S (!subs.SessionId || subs.SessionId == it->second .SessionId , " sessionId# " << subs.SessionId
157
+ << " node.SessionId# " << it->second .SessionId );
156
158
okay = true ;
157
159
}
158
- if (!sessionId ) {
160
+ if (!subs. SessionId ) {
159
161
okay = true ; // may be just obsolete subscription request
160
162
}
161
163
if (ConnectedDynamicNodes.contains (nodeId)) {
162
164
okay = true ;
163
165
}
164
166
Y_ABORT_UNLESS (okay);
167
+ if (subs.SubscriptionCookie ) {
168
+ const auto it = SubscriptionCookieMap.find (subs.SubscriptionCookie );
169
+ Y_ABORT_UNLESS (it != SubscriptionCookieMap.end ());
170
+ Y_ABORT_UNLESS (it->second == nodeId);
171
+ }
172
+ }
173
+ for (const auto & [cookie, nodeId] : SubscriptionCookieMap) {
174
+ const auto it = SubscribedSessions.find (nodeId);
175
+ Y_ABORT_UNLESS (it != SubscribedSessions.end ());
176
+ const TSessionSubscription& subs = it->second ;
177
+ Y_VERIFY_S (subs.SubscriptionCookie == cookie, " SubscriptionCookie# " << subs.SubscriptionCookie
178
+ << " cookie# " << cookie);
165
179
}
166
180
167
181
if (Binding) {
168
182
Y_ABORT_UNLESS (SubscribedSessions.contains (Binding->NodeId ));
169
183
}
170
184
for (const auto & [nodeId, info] : DirectBoundNodes) {
171
- Y_ABORT_UNLESS (SubscribedSessions.contains (nodeId));
185
+ Y_VERIFY_S (SubscribedSessions.contains (nodeId), " NodeId# " << nodeId );
172
186
}
173
187
174
188
Y_ABORT_UNLESS (!StorageConfig || CheckFingerprint (*StorageConfig));
@@ -229,6 +243,13 @@ namespace NKikimr::NStorage {
229
243
}
230
244
231
245
STFUNC (TDistributedConfigKeeper::StateFunc) {
246
+ STLOG (PRI_DEBUG, BS_NODE, NWDC15, " StateFunc" , (Type, ev->GetTypeRewrite ()), (Sender, ev->Sender ),
247
+ (SessionId, ev->InterconnectSession ), (Cookie, ev->Cookie ));
248
+ const ui32 senderNodeId = ev->Sender .NodeId ();
249
+ if (ev->InterconnectSession && SubscribedSessions.contains (senderNodeId)) {
250
+ // keep session actors intact
251
+ SubscribeToPeerNode (senderNodeId, ev->InterconnectSession );
252
+ }
232
253
STRICT_STFUNC_BODY (
233
254
hFunc (TEvNodeConfigPush, Handle);
234
255
hFunc (TEvNodeConfigReversePush, Handle);
@@ -239,7 +260,6 @@ namespace NKikimr::NStorage {
239
260
hFunc (TEvInterconnect::TEvNodesInfo, Handle);
240
261
hFunc (TEvInterconnect::TEvNodeConnected, Handle);
241
262
hFunc (TEvInterconnect::TEvNodeDisconnected, Handle);
242
- hFunc (TEvents::TEvUndelivered, Handle);
243
263
cFunc (TEvPrivate::EvErrorTimeout, HandleErrorTimeout);
244
264
hFunc (TEvPrivate::TEvStorageConfigLoaded, Handle);
245
265
hFunc (TEvPrivate::TEvStorageConfigStored, Handle);
@@ -252,6 +272,12 @@ namespace NKikimr::NStorage {
252
272
cFunc (TEvents::TSystem::Wakeup, HandleWakeup);
253
273
cFunc (TEvents::TSystem::Poison, PassAway);
254
274
)
275
+ for (ui32 nodeId : std::exchange (UnsubscribeQueue, {})) {
276
+ UnsubscribeInterconnect (nodeId);
277
+ }
278
+ if (IsSelfStatic && StorageConfig && NodeListObtained) {
279
+ IssueNextBindRequest ();
280
+ }
255
281
ConsistencyCheck ();
256
282
}
257
283
0 commit comments