Skip to content

Commit 69a8ead

Browse files
authored
Merge f04e650 into c2fa4d5
2 parents c2fa4d5 + f04e650 commit 69a8ead

File tree

14 files changed

+31
-23
lines changed

14 files changed

+31
-23
lines changed

ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_anubisfinder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ namespace NKikimr {
8989
// calculate keep status
9090
bool allowKeepFlags = HullCtx->AllowKeepFlags;
9191
NGc::TKeepStatus keep = brs->Keep(dbIt.GetCurKey(), dbMerger.GetMemRec(),
92-
dbMerger.GetMemRecsMerged(), allowKeepFlags,
93-
true /*allowGarbageCollection*/);
92+
dbMerger.GetMemRecsMerged(), subsMerger.GetMemRec(), allowKeepFlags,
93+
true /*allowGarbageCollection*/);
9494
if (keep.KeepIndex && !keep.KeepByBarrier) {
9595
// we keep this record because of keep flags
9696
candidates.AddCandidate(dbIt.GetCurKey().LogoBlobID());

ydb/core/blobstorage/vdisk/anubis_osiris/blobstorage_osiris.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace NKikimr {
2424
const TMemRecLogoBlob &memRec,
2525
ui32 recsMerged,
2626
bool allowKeepFlags) const {
27-
return BarriersEssence->Keep(key, memRec, recsMerged, allowKeepFlags, false /*allowGarbageCollection*/).KeepData;
27+
return BarriersEssence->Keep(key, memRec, recsMerged, memRec, allowKeepFlags, false /*allowGarbageCollection*/).KeepData;
2828
}
2929

3030
TIntrusivePtr<THullCtx> HullCtx;

ydb/core/blobstorage/vdisk/defrag/defrag_search.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ namespace NKikimr {
120120
void Finish() {
121121
if (!Merger.Empty()) {
122122
Y_ABORT_UNLESS(!Merger.HasSmallBlobs());
123-
NGc::TKeepStatus status = Barriers->Keep(Key, MemRec, NumMemRecsMerged, AllowKeepFlags, true /*allowGarbageCollection*/);
123+
NGc::TKeepStatus status = Barriers->Keep(Key, MemRec, NumMemRecsMerged, MemRec, AllowKeepFlags, true /*allowGarbageCollection*/);
124124
const auto& hugeMerger = Merger.GetHugeBlobMerger();
125125
const auto& local = MemRec.GetIngress().LocalParts(GType);
126126
ui8 partIdx = local.FirstPosition();

ydb/core/blobstorage/vdisk/hulldb/barriers/barriers_essence.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ namespace NKikimr {
6161
NGc::TKeepStatus TBarriersEssence::KeepLogoBlob(const TLogoBlobID &id,
6262
const TIngress &ingress,
6363
const ui32 recsMerged,
64+
const TIngress &ingressSubs,
6465
const bool allowKeepFlags,
6566
bool allowGarbageCollection) const
6667
{
@@ -88,8 +89,11 @@ namespace NKikimr {
8889
// flags says us to keep the record?
8990
const bool keepByFlags = ingress.KeepUnconditionally(IngressMode);
9091

91-
// is item is spread over multiple ssts?
92-
const bool itemIsSpreadOverMultipleSsts = recsMerged > 1;
92+
// is item is spread over multiple ssts? it's only meaningful when the subset item (the compacted one)
93+
// contains DoNotKeep flag and the whole database has the Keep one; otherwise this item is useless
94+
const bool itemIsSpreadOverMultipleSsts = recsMerged > 1 &&
95+
ingressSubs.GetCollectMode(IngressMode) & CollectModeDoNotKeep &&
96+
ingress.GetCollectMode(IngressMode) & CollectModeKeep;
9397

9498
// check if we have to keep data associated with this blob
9599
const bool keepData = (keepBySoftBarrier || keepByFlags) && keepByHardBarrier;

ydb/core/blobstorage/vdisk/hulldb/barriers/barriers_essence.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,18 @@ namespace NGcOpt {
3535
NGc::TKeepStatus Keep(const TKeyLogoBlob &key,
3636
const TMemRecLogoBlob &memRec,
3737
ui32 recsMerged,
38+
const TMemRecLogoBlob &memRecSubs, // for the compacted subset
3839
bool allowKeepFlags,
3940
bool allowGarbageCollection) const {
40-
const TIngress ingress = memRec.GetIngress();
4141
Y_DEBUG_ABORT_UNLESS(recsMerged >= 1);
42-
return KeepLogoBlob(key.LogoBlobID(), ingress, recsMerged, allowKeepFlags, allowGarbageCollection);
42+
return KeepLogoBlob(key.LogoBlobID(), memRec.GetIngress(), recsMerged, memRecSubs.GetIngress(),
43+
allowKeepFlags, allowGarbageCollection);
4344
}
4445

4546
NGc::TKeepStatus Keep(const TKeyBlock& /*key*/,
4647
const TMemRecBlock& /*memRec*/,
4748
ui32 /*recsMerged*/,
49+
const TMemRecBlock& /*memRecSubs*/,
4850
bool /*allowKeepFlags*/,
4951
bool /*allowGarbageCollection*/) const {
5052
// NOTE: We never delete block records, we only merge them. Merge rules are
@@ -56,6 +58,7 @@ namespace NGcOpt {
5658
NGc::TKeepStatus Keep(const TKeyBarrier& key,
5759
const TMemRecBarrier& /*memRec*/,
5860
ui32 /*recsMerged*/,
61+
const TMemRecBarrier& /*memRecSubs*/,
5962
bool /*allowKeepFlags*/,
6063
bool /*allowGarbageCollection*/) const {
6164
return KeepBarrier(key);
@@ -78,6 +81,7 @@ namespace NGcOpt {
7881
NGc::TKeepStatus KeepLogoBlob(const TLogoBlobID &id,
7982
const TIngress &ingress,
8083
const ui32 recsMerged,
84+
const TIngress &ingressSubs,
8185
const bool allowKeepFlags,
8286
bool allowGarbageCollection) const;
8387
};

ydb/core/blobstorage/vdisk/hulldb/blobstorage_hullgcmap.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ namespace NKikimr {
140140
Y_UNUSED(subsMerger);
141141
bool allowKeepFlags = HullCtx->AllowKeepFlags;
142142
NGc::TKeepStatus keep = barriersEssence->Keep(dbIt.GetCurKey(), dbMerger.GetMemRec(),
143-
dbMerger.GetMemRecsMerged(), allowKeepFlags,
144-
AllowGarbageCollection);
143+
dbMerger.GetMemRecsMerged(), subsMerger.GetMemRec(), allowKeepFlags, AllowGarbageCollection);
145144
Stat.Update(dbIt.GetCurKey(), keep);
146145
if (keep.KeepIndex) {
147146
IndexKeepMap.Set(Stat.ItemsTotal - 1);

ydb/core/blobstorage/vdisk/hulldb/compstrat/hulldb_compstrat_ratio.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ namespace NKikimr {
166166
NGc::TKeepStatus keep = BarriersEssence->Keep(dbIt.GetCurKey(),
167167
dbMerger.GetMemRec(),
168168
dbMerger.GetMemRecsMerged(),
169+
subsMerger.GetMemRec(),
169170
allowKeepFlags,
170171
AllowGarbageCollection);
171172
if (keep.KeepIndex) {

ydb/core/blobstorage/vdisk/query/query_extr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ namespace NKikimr {
6767
template<typename TMerger>
6868
bool IsBlobDeleted(const TLogoBlobID &id, const TMerger &merger) {
6969
const auto &status = BarriersEssence->Keep(id, merger.GetMemRec(), merger.GetMemRecsMerged(),
70-
QueryCtx->HullCtx->AllowKeepFlags, true /*allowGarbageCollection*/);
70+
merger.GetMemRec(), QueryCtx->HullCtx->AllowKeepFlags, true /*allowGarbageCollection*/);
7171
return !status.KeepData;
7272
}
7373

ydb/core/blobstorage/vdisk/query/query_range.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ namespace NKikimr {
124124
template<typename TMerger>
125125
void AddIndexOnly(const TLogoBlobID &logoBlobId, const TMerger &merger) {
126126
const auto &status = BarriersEssence->Keep(logoBlobId, merger.GetMemRec(), merger.GetMemRecsMerged(),
127-
QueryCtx->HullCtx->AllowKeepFlags, true /*allowGarbageCollection*/);
127+
merger.GetMemRec(), QueryCtx->HullCtx->AllowKeepFlags, true /*allowGarbageCollection*/);
128128
if (status.KeepData) {
129129
const TIngress &ingress = merger.GetMemRec().GetIngress();
130130
ui64 ingr = ingress.Raw();

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ namespace NKikimr {
128128
const TIngress ingress = memRec.GetIngress();
129129
const auto parts = ingress.PartsWeMustHaveLocally(&topology, ReplCtx->VCtx->ShortSelfVDisk,
130130
StartKey) - ingress.LocalParts(topology.GType);
131-
if (!parts.Empty() && barriers->Keep(StartKey, memRec, it.GetMemRecsMerged(), allowKeepFlags,
132-
true /*allowGarbageCollection*/).KeepData) {
131+
if (!parts.Empty() && barriers->Keep(StartKey, memRec, it.GetMemRecsMerged(), memRec,
132+
allowKeepFlags, true /*allowGarbageCollection*/).KeepData) {
133133
++ReplInfo->ItemsTotal;
134134
ReplInfo->WorkUnitsTotal += StartKey.BlobSize();
135135
}
@@ -168,8 +168,8 @@ namespace NKikimr {
168168
return false; // nothing to recover
169169
}
170170

171-
const NGc::TKeepStatus status = barriers.Keep(key, it.GetMemRec(), it.GetMemRecsMerged(), allowKeepFlags,
172-
true /*allowGarbageCollection*/);
171+
const NGc::TKeepStatus status = barriers.Keep(key, it.GetMemRec(), it.GetMemRecsMerged(), it.GetMemRec(),
172+
allowKeepFlags, true /*allowGarbageCollection*/);
173173
if (!status.KeepData) {
174174
return false; // no need to recover
175175
}

0 commit comments

Comments
 (0)