Skip to content

Commit 08db078

Browse files
authored
Merge 2706042 into ab119a2
2 parents ab119a2 + 2706042 commit 08db078

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <ydb/core/blobstorage/ut_blobstorage/lib/env.h>
2+
3+
Y_UNIT_TEST_SUITE(GarbageCollection) {
4+
Y_UNIT_TEST(EmptyGcCmd) {
5+
TEnvironmentSetup env({
6+
.Erasure = TBlobStorageGroupType::Erasure4Plus2Block,
7+
});
8+
auto& runtime = env.Runtime;
9+
10+
env.CreateBoxAndPool(1, 1);
11+
auto info = env.GetGroupInfo(env.GetGroups().front());
12+
13+
auto ev = std::make_unique<TEvBlobStorage::TEvCollectGarbage>(1u, 1u, 1u, 0u, false, 0u, 0u, nullptr, nullptr,
14+
TInstant::Max(), true);
15+
const TActorId edge = runtime->AllocateEdgeActor(1, __FILE__, __LINE__);
16+
runtime->WrapInActorContext(edge, [&] {
17+
SendToBSProxy(edge, info->GroupID, ev.release());
18+
});
19+
auto res = env.WaitForEdgeActorEvent<TEvBlobStorage::TEvCollectGarbageResult>(edge);
20+
UNIT_ASSERT_VALUES_EQUAL(res->Get()->Status, NKikimrProto::ERROR);
21+
}
22+
}

ydb/core/blobstorage/ut_blobstorage/ya.make

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ SRCS(
2222
ds_proxy_lwtrace.cpp
2323
encryption.cpp
2424
extra_block_checks.cpp
25+
gc.cpp
2526
gc_quorum_3dc.cpp
2627
get.cpp
2728
group_reconfiguration.cpp

ydb/core/blobstorage/vdisk/hullop/blobstorage_hull.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,13 @@ namespace NKikimr {
413413
if (!CheckGC(ctx, record))
414414
return {NKikimrProto::ERROR, 0, false}; // record has duplicates
415415

416+
if (!collect && !record.KeepSize() && !record.DoNotKeepSize()) {
417+
LOG_ERROR_S(ctx, NKikimrServices::BS_HULLRECS, HullDs->HullCtx->VCtx->VDiskLogPrefix
418+
<< "Db# Barriers ValidateGCCmd: empty garbage collection command"
419+
<< " TabletId# " << tabletID);
420+
return {NKikimrProto::ERROR, "empty garbage collection command"};
421+
}
422+
416423
auto blockStatus = THullDbRecovery::IsBlocked(record);
417424
switch (blockStatus.Status) {
418425
case TBlocksCache::EStatus::OK:

0 commit comments

Comments
 (0)