Skip to content

Commit

Permalink
Add TabletId and Status to TEvForceDataCleanupResult (#14380)
Browse files Browse the repository at this point in the history
  • Loading branch information
lex007in authored Feb 10, 2025
1 parent da88f78 commit e220453
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
8 changes: 7 additions & 1 deletion ydb/core/protos/tx_datashard.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2279,5 +2279,11 @@ message TEvForceDataCleanup {
// Returns DataCleanupGeneration of the last successfully completed TEvForceDataCleanup request.
// Intermediate requests and corresponding TEvForceDataCleanupResult's may be skipped.
message TEvForceDataCleanupResult {
optional uint64 DataCleanupGeneration = 1; // from corresponding request
enum EStatus {
OK = 0;
FAILED = 1;
};
optional uint64 DataCleanupGeneration = 1; // from corresponding request (or greater)
optional uint64 TabletId = 2;
optional EStatus Status = 3;
}
4 changes: 3 additions & 1 deletion ydb/core/tx/datashard/datashard.h
Original file line number Diff line number Diff line change
Expand Up @@ -1578,8 +1578,10 @@ namespace TEvDataShard {
TEvDataShard::EvForceDataCleanupResult> {
TEvForceDataCleanupResult() = default;

TEvForceDataCleanupResult(ui64 dataCleanupGeneration) {
TEvForceDataCleanupResult(ui64 dataCleanupGeneration, ui64 tabletId, NKikimrTxDataShard::TEvForceDataCleanupResult::EStatus status) {
Record.SetDataCleanupGeneration(dataCleanupGeneration);
Record.SetTabletId(tabletId);
Record.SetStatus(status);
}
};

Expand Down
5 changes: 4 additions & 1 deletion ydb/core/tx/datashard/datashard__data_cleanup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ namespace NKikimr::NDataShard {
void TDataShard::Handle(TEvDataShard::TEvForceDataCleanup::TPtr& ev, const TActorContext& ctx) {
// TODO: implement
const auto& record = ev->Get()->Record;
auto result = MakeHolder<TEvDataShard::TEvForceDataCleanupResult>(record.GetDataCleanupGeneration());
auto result = MakeHolder<TEvDataShard::TEvForceDataCleanupResult>(
record.GetDataCleanupGeneration(),
TabletID(),
NKikimrTxDataShard::TEvForceDataCleanupResult::OK);
ctx.Send(ev->Sender, std::move(result));
}

Expand Down
2 changes: 2 additions & 0 deletions ydb/core/tx/datashard/datashard_ut_data_cleanup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Y_UNIT_TEST_SUITE(DataCleanup) {

auto ev = runtime.GrabEdgeEventRethrow<TEvDataShard::TEvForceDataCleanupResult>(sender);
UNIT_ASSERT_VALUES_EQUAL(ev->Get()->Record.GetDataCleanupGeneration(), expectedDataCleanupGeneration);
UNIT_ASSERT_VALUES_EQUAL(ev->Get()->Record.GetTabletId(), shards.at(0));
UNIT_ASSERT_EQUAL(ev->Get()->Record.GetStatus(), NKikimrTxDataShard::TEvForceDataCleanupResult::OK);
}
}

Expand Down

0 comments on commit e220453

Please sign in to comment.