aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Rutkovsky <alexvru@ydb.tech>2024-07-08 18:06:12 +0300
committerGitHub <noreply@github.com>2024-07-08 18:06:12 +0300
commit4cc05ae592ef753b566a8b8d77b258aefc3678bf (patch)
tree765951392594310ce4cd217784d247ef80e7ced3
parenta902648c4cda42d6df2f63ea76ddb2b658f074d9 (diff)
downloadydb-4cc05ae592ef753b566a8b8d77b258aefc3678bf.tar.gz
Handle empty GC commands correctly (#6398)
-rw-r--r--ydb/core/blobstorage/ut_blobstorage/gc.cpp22
-rw-r--r--ydb/core/blobstorage/ut_blobstorage/ya.make1
-rw-r--r--ydb/core/blobstorage/vdisk/hullop/blobstorage_hull.cpp7
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: