diff options
author | ilnaz <ilnaz@ydb.tech> | 2023-04-07 12:18:58 +0300 |
---|---|---|
committer | ilnaz <ilnaz@ydb.tech> | 2023-04-07 12:18:58 +0300 |
commit | 21b23100b7762bb785ac36bf473389453124377a (patch) | |
tree | 41274cdb160eafbb80fb2f5f89496768f9a65057 | |
parent | a99d2644ac460383617c0eb6fb5a6b3cf7e43048 (diff) | |
download | ydb-21b23100b7762bb785ac36bf473389453124377a.tar.gz |
Remember sync state when restarting populator
-rw-r--r-- | ydb/core/tx/scheme_board/replica.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/ydb/core/tx/scheme_board/replica.cpp b/ydb/core/tx/scheme_board/replica.cpp index 4771206aa05..e104ead92ff 100644 --- a/ydb/core/tx/scheme_board/replica.cpp +++ b/ydb/core/tx/scheme_board/replica.cpp @@ -528,16 +528,13 @@ private: struct TPopulatorInfo { ui64 Generation = 0; ui64 PendingGeneration = 0; + bool IsCommited = false; TActorId PopulatorActor; - - bool IsCommited() const { - return Generation && Generation == PendingGeneration; - } }; bool IsPopulatorCommited(ui64 ownerId) const { auto it = Populators.find(ownerId); - if (it != Populators.end() && it->second.IsCommited()) { + if (it != Populators.end() && it->second.IsCommited) { return true; } @@ -1006,6 +1003,7 @@ private: << ", generation# " << generation); info.Generation = info.PendingGeneration; + info.IsCommited = true; Send(ev->Sender, new TSchemeBoardEvents::TEvCommitResponse(owner, info.Generation), 0, ev->Cookie); if (WaitStrongNotifications.contains(owner)) { @@ -1274,14 +1272,14 @@ private: } void PassAway() override { - for (auto &xpair : Populators) { - if (const TActorId populator = xpair.second.PopulatorActor) { - Send(populator, new TEvStateStorage::TEvReplicaShutdown()); + for (const auto& [_, info] : Populators) { + if (const auto& actorId = info.PopulatorActor) { + Send(actorId, new TEvStateStorage::TEvReplicaShutdown()); } } - for (auto &xpair : Subscribers) { - Send(xpair.first, new TEvStateStorage::TEvReplicaShutdown()); + for (const auto& [actorId, _] : Subscribers) { + Send(actorId, new TEvStateStorage::TEvReplicaShutdown()); } TMonitorableActor::PassAway(); |