diff options
author | Alexander Rutkovsky <alexvru@ydb.tech> | 2024-07-08 18:06:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-08 18:06:12 +0300 |
commit | 4cc05ae592ef753b566a8b8d77b258aefc3678bf (patch) | |
tree | 765951392594310ce4cd217784d247ef80e7ced3 | |
parent | a902648c4cda42d6df2f63ea76ddb2b658f074d9 (diff) | |
download | ydb-4cc05ae592ef753b566a8b8d77b258aefc3678bf.tar.gz |
Handle empty GC commands correctly (#6398)
-rw-r--r-- | ydb/core/blobstorage/ut_blobstorage/gc.cpp | 22 | ||||
-rw-r--r-- | ydb/core/blobstorage/ut_blobstorage/ya.make | 1 | ||||
-rw-r--r-- | ydb/core/blobstorage/vdisk/hullop/blobstorage_hull.cpp | 7 |
3 files changed, 30 insertions, 0 deletions
diff --git a/ydb/core/blobstorage/ut_blobstorage/gc.cpp b/ydb/core/blobstorage/ut_blobstorage/gc.cpp new file mode 100644 index 0000000000..80c7790932 --- /dev/null +++ b/ydb/core/blobstorage/ut_blobstorage/gc.cpp @@ -0,0 +1,22 @@ +#include <ydb/core/blobstorage/ut_blobstorage/lib/env.h> + +Y_UNIT_TEST_SUITE(GarbageCollection) { + Y_UNIT_TEST(EmptyGcCmd) { + TEnvironmentSetup env({ + .Erasure = TBlobStorageGroupType::Erasure4Plus2Block, + }); + auto& runtime = env.Runtime; + + env.CreateBoxAndPool(1, 1); + auto info = env.GetGroupInfo(env.GetGroups().front()); + + auto ev = std::make_unique<TEvBlobStorage::TEvCollectGarbage>(1u, 1u, 1u, 0u, false, 0u, 0u, nullptr, nullptr, + TInstant::Max(), true); + const TActorId edge = runtime->AllocateEdgeActor(1, __FILE__, __LINE__); + runtime->WrapInActorContext(edge, [&] { + SendToBSProxy(edge, info->GroupID, ev.release()); + }); + auto res = env.WaitForEdgeActorEvent<TEvBlobStorage::TEvCollectGarbageResult>(edge); + UNIT_ASSERT_VALUES_EQUAL(res->Get()->Status, NKikimrProto::ERROR); + } +} diff --git a/ydb/core/blobstorage/ut_blobstorage/ya.make b/ydb/core/blobstorage/ut_blobstorage/ya.make index 0edf9906ed..ba965e9e83 100644 --- a/ydb/core/blobstorage/ut_blobstorage/ya.make +++ b/ydb/core/blobstorage/ut_blobstorage/ya.make @@ -22,6 +22,7 @@ SRCS( ds_proxy_lwtrace.cpp encryption.cpp extra_block_checks.cpp + gc.cpp gc_quorum_3dc.cpp get.cpp group_reconfiguration.cpp diff --git a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hull.cpp b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hull.cpp index fedaca0421..a1eeb6af94 100644 --- a/ydb/core/blobstorage/vdisk/hullop/blobstorage_hull.cpp +++ b/ydb/core/blobstorage/vdisk/hullop/blobstorage_hull.cpp @@ -413,6 +413,13 @@ namespace NKikimr { if (!CheckGC(ctx, record)) return {NKikimrProto::ERROR, 0, false}; // record has duplicates + if (!collect && !record.KeepSize() && !record.DoNotKeepSize()) { + LOG_ERROR_S(ctx, NKikimrServices::BS_HULLRECS, HullDs->HullCtx->VCtx->VDiskLogPrefix + << "Db# Barriers ValidateGCCmd: empty garbage collection command" + << " TabletId# " << tabletID); + return {NKikimrProto::ERROR, "empty garbage collection command"}; + } + auto blockStatus = THullDbRecovery::IsBlocked(record); switch (blockStatus.Status) { case TBlocksCache::EStatus::OK: |