Skip to content

Commit

Permalink
[Blockstore] StatVolume should return checkpoints without data (#2925)
Browse files Browse the repository at this point in the history
* edit volume actor statvolume and fix it's unit tests

* edit volume actor statvolume and fix it's unit tests

* fix ut

* rename extra variable

* add additional checks in UT
  • Loading branch information
Rattysed authored Feb 5, 2025
1 parent ed97416 commit 2aae06d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,11 @@ void TVolumeActor::HandleStatVolume(
partConfig->GetMaxTimedOutDeviceStateDuration().MilliSeconds());
}

TVector<TString> checkpoints =
State->GetCheckpointStore().GetCheckpointsWithData();
TActiveCheckpointsMap activeCheckpoints = State->GetCheckpointStore().GetActiveCheckpoints();
TVector<TString> checkpoints(Reserve(activeCheckpoints.size()));
for (const auto& [checkpoint, _] : activeCheckpoints) {
checkpoints.push_back(checkpoint);
}

TStringBuilder debugString;
for (const auto& statInfo: State->GetPartitionStatInfos()) {
Expand Down
12 changes: 10 additions & 2 deletions cloud/blockstore/libs/storage/volume/volume_ut_checkpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,12 @@ Y_UNIT_TEST_SUITE(TVolumeCheckpointTest)
UNIT_ASSERT_VALUES_EQUAL("c1", stat->Record.GetCheckpoints()[0]);
}
volume.DeleteCheckpointData("c1");
{
auto stat = volume.StatVolume();
UNIT_ASSERT_VALUES_EQUAL(1, stat->Record.GetCheckpoints().size());
UNIT_ASSERT_VALUES_EQUAL("c1", stat->Record.GetCheckpoints()[0]);
}
volume.DeleteCheckpoint("c1");
{
auto stat = volume.StatVolume();
UNIT_ASSERT(stat->Record.GetCheckpoints().empty());
Expand Down Expand Up @@ -1930,7 +1936,8 @@ Y_UNIT_TEST_SUITE(TVolumeCheckpointTest)
{
auto stat = volume.StatVolume();
const auto& cp = stat->Record.GetCheckpoints();
UNIT_ASSERT_VALUES_EQUAL(0, cp.size());
UNIT_ASSERT_VALUES_EQUAL(1, cp.size());
UNIT_ASSERT_VALUES_EQUAL("c1", stat->Record.GetCheckpoints(0));
}

volume.RebootTablet();
Expand All @@ -1940,7 +1947,8 @@ Y_UNIT_TEST_SUITE(TVolumeCheckpointTest)
{
auto stat = volume.StatVolume();
const auto& cp = stat->Record.GetCheckpoints();
UNIT_ASSERT_VALUES_EQUAL(0, cp.size());
UNIT_ASSERT_VALUES_EQUAL(1, cp.size());
UNIT_ASSERT_VALUES_EQUAL("c1", stat->Record.GetCheckpoints(0));
}

{
Expand Down

0 comments on commit 2aae06d

Please sign in to comment.