@@ -2880,7 +2880,7 @@ class TTxMonEvent_RebalanceFromScratch : public TTransactionBase<THive> {
28802880class TReassignTabletWaitActor : public TActor <TReassignTabletWaitActor>, public ISubActor {
28812881public:
28822882 TActorId Source;
2883- ui32 TabletsTotal = std::numeric_limits<ui32>::max() ;
2883+ ui32 TabletsTotal = 0 ;
28842884 ui32 TabletsDone = 0 ;
28852885 THive* Hive;
28862886
@@ -2907,14 +2907,23 @@ class TReassignTabletWaitActor : public TActor<TReassignTabletWaitActor>, public
29072907 return SelfId ().LocalId ();
29082908 }
29092909
2910- void Handle (TEvPrivate::TEvRestartComplete::TPtr&) {
2911- ++TabletsDone;
2910+ void AddTablet (TLeaderTabletInfo* tablet) {
2911+ tablet->ActorsToNotifyOnRestart .push_back (SelfId ());
2912+ ++TabletsTotal;
2913+ }
2914+
2915+ void CheckCompletion () {
29122916 if (TabletsDone >= TabletsTotal) {
29132917 Send (Source, new NMon::TEvRemoteJsonInfoRes (TStringBuilder () << " {\" total\" :" << TabletsDone << " }" ));
29142918 PassAway ();
29152919 }
29162920 }
29172921
2922+ void Handle (TEvPrivate::TEvRestartComplete::TPtr&) {
2923+ ++TabletsDone;
2924+ CheckCompletion ();
2925+ }
2926+
29182927 STATEFN (StateWork) {
29192928 switch (ev->GetTypeRewrite ()) {
29202929 cFunc (TEvents::TSystem::PoisonPill, PassAway);
@@ -3042,12 +3051,12 @@ class TTxMonEvent_ReassignTablet : public TTransactionBase<THive> {
30423051 continue ;
30433052 }
30443053 if (Wait) {
3045- tablet-> ActorsToNotifyOnRestart . emplace_back (waitActorId); // volatile settings, will not persist upon restart
3054+ waitActor-> AddTablet (tablet);
30463055 }
30473056 operations.emplace_back (new TEvHive::TEvReassignTablet (tablet->Id , channels, forcedGroupIds, Async));
30483057 }
30493058 if (Wait) {
3050- waitActor->TabletsTotal = operations. size ();
3059+ waitActor->CheckCompletion ();
30513060 }
30523061 for (auto & op : operations) {
30533062 ctx.Send (Self->SelfId (), op.Release ());
0 commit comments