Skip to content

Commit

Permalink
Statistics: status for TEvAnalyzeResponse (#8404)
Browse files Browse the repository at this point in the history
  • Loading branch information
azevaykin authored Aug 29, 2024
1 parent 0e3255d commit 724e14e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ydb/core/protos/out/out.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ Y_DECLARE_OUT_SPEC(, NKikimrDataEvents::TEvWrite::ETxMode, stream, value) {
stream << NKikimrDataEvents::TEvWrite::ETxMode_Name(value);
}

Y_DECLARE_OUT_SPEC(, NKikimrStat::TEvAnalyzeResponse_EStatus, stream, value) {
stream << NKikimrStat::TEvAnalyzeResponse_EStatus_Name(value);
}

Y_DECLARE_OUT_SPEC(, NKikimrStat::TEvAnalyzeStatusResponse_EStatus, stream, value) {
stream << NKikimrStat::TEvAnalyzeStatusResponse_EStatus_Name(value);
}
Expand Down
7 changes: 7 additions & 0 deletions ydb/core/protos/statistics.proto
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ message TEvAnalyze {
// SA -> KQP
message TEvAnalyzeResponse {
optional bytes OperationId = 1;

enum EStatus {
STATUS_UNSPECIFIED = 0;
STATUS_SUCCESS = 1;
STATUS_ERROR = 2;
}
optional EStatus Status = 2;
}

// KQP -> SA
Expand Down
1 change: 1 addition & 0 deletions ydb/core/statistics/aggregator/tx_analyze_deadline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ struct TStatisticsAggregator::TTxAnalyzeDeadline : public TTxBase {
"Send TEvAnalyzeResponse for deleted operation, OperationId=" << OperationId << ", ActorId=" << ReplyToActorId);
auto response = std::make_unique<TEvStatistics::TEvAnalyzeResponse>();
response->Record.SetOperationId(OperationId);
response->Record.SetStatus(NKikimrStat::TEvAnalyzeResponse::STATUS_ERROR);
ctx.Send(ReplyToActorId, response.release());
} else {
SA_LOG_D("[" << Self->TabletID() << "] TTxAnalyzeDeadline::Complete. No ActorId to send reply. OperationId=" << OperationId);
Expand Down
1 change: 1 addition & 0 deletions ydb/core/statistics/aggregator/tx_finish_trasersal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ struct TStatisticsAggregator::TTxFinishTraversal : public TTxBase {
"Send TEvAnalyzeResponse, OperationId=" << OperationId << ", ActorId=" << ReplyToActorId);
auto response = std::make_unique<TEvStatistics::TEvAnalyzeResponse>();
response->Record.SetOperationId(OperationId);
response->Record.SetStatus(NKikimrStat::TEvAnalyzeResponse::STATUS_SUCCESS);
ctx.Send(ReplyToActorId, response.release());
}
}
Expand Down
5 changes: 4 additions & 1 deletion ydb/core/statistics/aggregator/ut/ut_analyze_columnshard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,10 @@ Y_UNIT_TEST_SUITE(AnalyzeColumnshard) {
runtime.WaitFor("TEvAnalyzeTableResponse", [&]{ return block.size(); });
runtime.AdvanceCurrentTime(TDuration::Days(2));

runtime.GrabEdgeEventRethrow<TEvStatistics::TEvAnalyzeResponse>(sender);
auto analyzeResponse = runtime.GrabEdgeEventRethrow<TEvStatistics::TEvAnalyzeResponse>(sender);
const auto& record = analyzeResponse->Get()->Record;
UNIT_ASSERT_VALUES_EQUAL(record.GetOperationId(), "operationId");
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrStat::TEvAnalyzeResponse::STATUS_ERROR);
}
}

Expand Down
4 changes: 3 additions & 1 deletion ydb/core/statistics/ut_common/ut_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,9 @@ void Analyze(TTestActorRuntime& runtime, ui64 saTabletId, const std::vector<TAna
runtime.SendToPipe(saTabletId, sender, ev.release());
auto evResponse = runtime.GrabEdgeEventRethrow<TEvStatistics::TEvAnalyzeResponse>(sender);

UNIT_ASSERT_VALUES_EQUAL(evResponse->Get()->Record.GetOperationId(), operationId);
const auto& record = evResponse->Get()->Record;
UNIT_ASSERT_VALUES_EQUAL(record.GetOperationId(), operationId);
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrStat::TEvAnalyzeResponse::STATUS_SUCCESS);
}

void AnalyzeTable(TTestActorRuntime& runtime, ui64 shardTabletId, const TAnalyzedTable& table) {
Expand Down

0 comments on commit 724e14e

Please sign in to comment.