Skip to content

Commit 8e31588

Browse files
vporyadkeydbot
authored andcommitted
fix stuck reassign actor (#28195)
1 parent 84a5f3f commit 8e31588

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

ydb/core/mind/hive/monitoring.cpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2880,7 +2880,7 @@ class TTxMonEvent_RebalanceFromScratch : public TTransactionBase<THive> {
28802880
class TReassignTabletWaitActor : public TActor<TReassignTabletWaitActor>, public ISubActor {
28812881
public:
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

Comments
 (0)