From 2aae06dffeae2b2ff1a32e78c1484e782390ea90 Mon Sep 17 00:00:00 2001 From: Aleksey Skvortsov <46933547+Rattysed@users.noreply.github.com> Date: Wed, 5 Feb 2025 18:20:41 +0300 Subject: [PATCH] [Blockstore] StatVolume should return checkpoints without data (#2925) * 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 --- .../libs/storage/volume/volume_actor_statvolume.cpp | 7 +++++-- .../libs/storage/volume/volume_ut_checkpoint.cpp | 12 ++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/cloud/blockstore/libs/storage/volume/volume_actor_statvolume.cpp b/cloud/blockstore/libs/storage/volume/volume_actor_statvolume.cpp index 9d13949f7ee..e3386232f19 100644 --- a/cloud/blockstore/libs/storage/volume/volume_actor_statvolume.cpp +++ b/cloud/blockstore/libs/storage/volume/volume_actor_statvolume.cpp @@ -295,8 +295,11 @@ void TVolumeActor::HandleStatVolume( partConfig->GetMaxTimedOutDeviceStateDuration().MilliSeconds()); } - TVector checkpoints = - State->GetCheckpointStore().GetCheckpointsWithData(); + TActiveCheckpointsMap activeCheckpoints = State->GetCheckpointStore().GetActiveCheckpoints(); + TVector checkpoints(Reserve(activeCheckpoints.size())); + for (const auto& [checkpoint, _] : activeCheckpoints) { + checkpoints.push_back(checkpoint); + } TStringBuilder debugString; for (const auto& statInfo: State->GetPartitionStatInfos()) { diff --git a/cloud/blockstore/libs/storage/volume/volume_ut_checkpoint.cpp b/cloud/blockstore/libs/storage/volume/volume_ut_checkpoint.cpp index 0b430ef75ee..8d464a99444 100644 --- a/cloud/blockstore/libs/storage/volume/volume_ut_checkpoint.cpp +++ b/cloud/blockstore/libs/storage/volume/volume_ut_checkpoint.cpp @@ -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()); @@ -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(); @@ -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)); } {