Skip to content

Commit 5c7d385

Browse files
authored
Merge 8734059 into 979d449
2 parents 979d449 + 8734059 commit 5c7d385

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed
+22
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

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ SRCS(
1919
defrag.cpp
2020
encryption.cpp
2121
extra_block_checks.cpp
22+
gc.cpp
2223
gc_quorum_3dc.cpp
2324
group_reconfiguration.cpp
2425
incorrect_queries.cpp

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

+7
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,13 @@ namespace NKikimr {
415415
if (!CheckGC(ctx, record))
416416
return {NKikimrProto::ERROR, 0, false}; // record has duplicates
417417

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

ydb/core/blobstorage/vdisk/repl/blobstorage_repl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,8 @@ namespace NKikimr {
409409
// no more blobs to replicate; replication will not resume
410410
State = Finished;
411411
ReplCtx->MonGroup.ReplUnreplicatedVDisks() = 0;
412-
ReplCtx->MonGroup.ReplUnreplicatedPhantoms() = 1;
413-
ReplCtx->MonGroup.ReplUnreplicatedNonPhantoms() = 1;
412+
ReplCtx->MonGroup.ReplUnreplicatedPhantoms() = 0;
413+
ReplCtx->MonGroup.ReplUnreplicatedNonPhantoms() = 0;
414414
ReplCtx->MonGroup.ReplWorkUnitsRemaining() = 0;
415415
ReplCtx->MonGroup.ReplWorkUnitsDone() = 0;
416416
ReplCtx->MonGroup.ReplItemsRemaining() = 0;

0 commit comments

Comments
 (0)