Skip to content

Commit da489d0

Browse files
authored
Merge 9ed6602 into 9b567af
2 parents 9b567af + 9ed6602 commit da489d0

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

ydb/core/statistics/aggregator/tx_init.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,12 @@ struct TStatisticsAggregator::TTxInit : public TTxBase {
227227
ui64 ownerId = rowset.GetValue<Schema::ForceTraversalTables::OwnerId>();
228228
ui64 localPathId = rowset.GetValue<Schema::ForceTraversalTables::LocalPathId>();
229229
TString columnTags = rowset.GetValue<Schema::ForceTraversalTables::ColumnTags>();
230-
ui64 status = rowset.GetValue<Schema::ForceTraversalTables::Status>();
230+
TForceTraversalTable::EStatus status = (TForceTraversalTable::EStatus)rowset.GetValue<Schema::ForceTraversalTables::Status>();
231+
232+
if (status == TForceTraversalTable::EStatus::AnalyzeStarted) {
233+
// Resent TEvAnalyzeTable to shards
234+
status = TForceTraversalTable::EStatus::None;
235+
}
231236

232237
auto pathId = TPathId(ownerId, localPathId);
233238

@@ -270,7 +275,7 @@ struct TStatisticsAggregator::TTxInit : public TTxBase {
270275

271276
Self->InitializeStatisticsTable();
272277

273-
if (Self->TraversalPathId) {
278+
if (Self->TraversalPathId && Self->TraversalStartKey) {
274279
Self->NavigateType = ENavigateType::Traversal;
275280
Self->NavigatePathId = Self->TraversalPathId;
276281
Self->Navigate();

ydb/core/statistics/aggregator/ut/ut_analyze_columnshard.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,34 @@ Y_UNIT_TEST_SUITE(AnalyzeColumnshard) {
117117
UNIT_ASSERT(!response2);
118118
}
119119

120+
Y_UNIT_TEST(AnalyzeRebootSa) {
121+
TTestEnv env(1, 1);
122+
auto& runtime = *env.GetServer().GetRuntime();
123+
auto tableInfo = CreateDatabaseTables(env, 1, 1)[0];
124+
125+
auto sender = runtime.AllocateEdgeActor();
126+
127+
bool eventSeen = false;
128+
auto observer = runtime.AddObserver<TEvStatistics::TEvAnalyzeTableResponse>([&](auto&) {
129+
if (!eventSeen) {
130+
RebootTablet(runtime, tableInfo.SaTabletId, sender);
131+
eventSeen = true;
132+
}
133+
});
134+
135+
auto analyzeRequest1 = MakeAnalyzeRequest({tableInfo.PathId});
136+
runtime.SendToPipe(tableInfo.SaTabletId, sender, analyzeRequest1.release());
137+
138+
runtime.WaitFor("blocked 1st TEvAnalyzeTableResponse event", [&]{ return eventSeen; });
139+
140+
RebootTablet(runtime, tableInfo.SaTabletId, sender);
141+
142+
auto analyzeRequest2 = MakeAnalyzeRequest({tableInfo.PathId});
143+
runtime.SendToPipe(tableInfo.SaTabletId, sender, analyzeRequest2.release());
144+
145+
runtime.GrabEdgeEventRethrow<TEvStatistics::TEvAnalyzeResponse>(sender);
146+
}
147+
120148
}
121149

122150
} // NStat

0 commit comments

Comments
 (0)