Skip to content

Commit b4bda2b

Browse files
authored
fix potential GetStatistics hanging during rolling update (#9942)
1 parent b9d03c8 commit b4bda2b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ydb/core/statistics/service/service_impl.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
664664
request.StatType = ev->Get()->StatType;
665665
request.StatRequests.swap(ev->Get()->StatRequests);
666666

667-
if (!EnableStatistics) {
667+
if (!EnableStatistics || IsStatisticsDisabledInSA) {
668668
ReplyFailed(requestId, true);
669669
return;
670670
}
@@ -842,6 +842,8 @@ class TStatService : public TActorBootstrapped<TStatService> {
842842

843843
Send(ev->Sender, new TEvStatistics::TEvPropagateStatisticsResponse);
844844

845+
IsStatisticsDisabledInSA = false;
846+
845847
auto* record = ev->Get()->MutableRecord();
846848
for (const auto& entry : record->GetEntries()) {
847849
ui64 schemeShardId = entry.GetSchemeShardId();
@@ -994,6 +996,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
994996
<< ", status = " << ev->Get()->Status);
995997

996998
if (clientId == SAPipeClientId) {
999+
IsStatisticsDisabledInSA = false;
9971000
if (ev->Get()->Status != NKikimrProto::OK) {
9981001
SAPipeClientId = TActorId();
9991002
ConnectToSA();
@@ -1030,6 +1033,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
10301033
<< ", tablet id = " << tabletId);
10311034

10321035
if (clientId == SAPipeClientId) {
1036+
IsStatisticsDisabledInSA = false;
10331037
SAPipeClientId = TActorId();
10341038
ConnectToSA();
10351039
SyncNode();
@@ -1049,6 +1053,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
10491053
}
10501054

10511055
void Handle(TEvStatistics::TEvStatisticsIsDisabled::TPtr&) {
1056+
IsStatisticsDisabledInSA = true;
10521057
ReplyAllFailed();
10531058
}
10541059

@@ -1527,6 +1532,7 @@ class TStatService : public TActorBootstrapped<TStatService> {
15271532

15281533
bool EnableStatistics = false;
15291534
bool EnableColumnStatistics = false;
1535+
bool IsStatisticsDisabledInSA = false;
15301536

15311537
static constexpr size_t StatFanOut = 10;
15321538

0 commit comments

Comments
 (0)