Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions ydb/core/mind/hive/monitoring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2880,7 +2880,7 @@ class TTxMonEvent_RebalanceFromScratch : public TTransactionBase<THive> {
class TReassignTabletWaitActor : public TActor<TReassignTabletWaitActor>, public ISubActor {
public:
TActorId Source;
ui32 TabletsTotal = std::numeric_limits<ui32>::max();
ui32 TabletsTotal = 0;
ui32 TabletsDone = 0;
THive* Hive;

Expand All @@ -2907,14 +2907,23 @@ class TReassignTabletWaitActor : public TActor<TReassignTabletWaitActor>, public
return SelfId().LocalId();
}

void Handle(TEvPrivate::TEvRestartComplete::TPtr&) {
++TabletsDone;
void AddTablet(TLeaderTabletInfo* tablet) {
tablet->ActorsToNotifyOnRestart.push_back(SelfId());
++TabletsTotal;
}

void CheckCompletion() {
if (TabletsDone >= TabletsTotal) {
Send(Source, new NMon::TEvRemoteJsonInfoRes(TStringBuilder() << "{\"total\":" << TabletsDone << "}"));
PassAway();
}
}

void Handle(TEvPrivate::TEvRestartComplete::TPtr&) {
++TabletsDone;
CheckCompletion();
}

STATEFN(StateWork) {
switch (ev->GetTypeRewrite()) {
cFunc(TEvents::TSystem::PoisonPill, PassAway);
Expand Down Expand Up @@ -3042,12 +3051,12 @@ class TTxMonEvent_ReassignTablet : public TTransactionBase<THive> {
continue;
}
if (Wait) {
tablet->ActorsToNotifyOnRestart.emplace_back(waitActorId); // volatile settings, will not persist upon restart
waitActor->AddTablet(tablet);
}
operations.emplace_back(new TEvHive::TEvReassignTablet(tablet->Id, channels, forcedGroupIds, Async));
}
if (Wait) {
waitActor->TabletsTotal = operations.size();
waitActor->CheckCompletion();
}
for (auto& op : operations) {
ctx.Send(Self->SelfId(), op.Release());
Expand Down
Loading