Skip to content

Commit

Permalink
Fix unsubscription race in distconf dynamic node code (ydb-platform#6312
Browse files Browse the repository at this point in the history
)
  • Loading branch information
alexvru authored Jul 5, 2024
1 parent 2540624 commit 7b7a29c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ydb/core/blobstorage/nodewarden/distconf_dynamic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,19 @@ namespace NKikimr::NStorage {
StaticNodeSessionId = sessionId;
}

void TDistributedConfigKeeper::OnStaticNodeDisconnected(ui32 nodeId, TActorId /*sessionId*/) {
Y_ABORT_UNLESS(nodeId == ConnectedToStaticNode);
void TDistributedConfigKeeper::OnStaticNodeDisconnected(ui32 nodeId, TActorId sessionId) {
if (nodeId != ConnectedToStaticNode || (StaticNodeSessionId && StaticNodeSessionId != sessionId)) {
return; // possible race with unsubscription
}
ConnectedToStaticNode = 0;
StaticNodeSessionId = {};
ConnectToStaticNode();
}

void TDistributedConfigKeeper::Handle(TEvNodeWardenDynamicConfigPush::TPtr ev) {
Y_ABORT_UNLESS(StaticNodeSessionId);
Y_ABORT_UNLESS(ev->InterconnectSession == StaticNodeSessionId);
if (ev->Sender.NodeId() != ConnectedToStaticNode || !StaticNodeSessionId || ev->InterconnectSession != StaticNodeSessionId) {
return; // this may be a race with unsubscription
}
auto& record = ev->Get()->Record;
if (record.HasConfig()) {
ApplyStorageConfig(record.GetConfig());
Expand Down

0 comments on commit 7b7a29c

Please sign in to comment.