Skip to content

Commit 67e208d

Browse files
fix build
1 parent 0fd7910 commit 67e208d

File tree

5 files changed

+47
-25
lines changed

5 files changed

+47
-25
lines changed

ydb/core/tx/columnshard/blobs_action/abstract/blob_set.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22
#include <ydb/core/tx/columnshard/common/tablet_id.h>
33
#include <ydb/core/tx/columnshard/blob.h>
4+
#include <ydb/core/util/gen_step.h>
45

56
#include <ydb/library/accessor/accessor.h>
67
#include <ydb/library/services/services.pb.h>
@@ -47,7 +48,7 @@ class TTabletByBlob {
4748
class TBlobsByGenStep {
4849
private:
4950
struct Comparator {
50-
bool operator<(const TLogoBlobID& l, const TLogoBlobID& r) const {
51+
bool operator()(const TLogoBlobID& l, const TLogoBlobID& r) const {
5152
TGenStep gsl(l);
5253
TGenStep gsr(l);
5354
if (gsl == gsr) {
@@ -65,6 +66,9 @@ class TBlobsByGenStep {
6566
[[nodiscard]] bool Remove(const TLogoBlobID& blobId) {
6667
return Blobs.erase(blobId);
6768
}
69+
bool IsEmpty() const {
70+
return Blobs.empty();
71+
}
6872
ui32 GetSize() const {
6973
return Blobs.size();
7074
}
@@ -75,11 +79,11 @@ class TBlobsByGenStep {
7579
}
7680

7781
template <class TActor>
78-
bool ExtractFront(const TGenStep border, const ui32 countLimit, const TActor& actor) {
82+
bool ExtractTo(const TGenStep includeBorder, const ui32 countLimit, const TActor& actor) {
7983
ui32 idx = 0;
8084
for (auto it = Blobs.begin(); it != Blobs.end(); ++it) {
8185
TGenStep gs(*it);
82-
if (border < gs) {
86+
if (includeBorder < gs) {
8387
return true;
8488
}
8589
if (++idx > countLimit) {

ydb/core/tx/columnshard/blobs_action/bs/blob_manager.cpp

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ void TBlobBatch::SendWriteBlobRequest(const TString& blobData, const TUnifiedBlo
8888
}
8989

9090
void TBlobBatch::OnBlobWriteResult(const TLogoBlobID& blobId, const NKikimrProto::EReplyStatus status) {
91-
BatchInfo->Counters.OnPutResult(blobId.BlobSize());
9291
Y_ABORT_UNLESS(status == NKikimrProto::OK, "The caller must handle unsuccessful status");
9392
Y_ABORT_UNLESS(BatchInfo);
9493
Y_ABORT_UNLESS(blobId.Cookie() < BatchInfo->InFlight.size());
@@ -204,6 +203,22 @@ class TBlobManager::TGCContext {
204203
YDB_ACCESSOR_DEF(std::deque<TUnifiedBlobId>, KeepsToErase);
205204
YDB_READONLY_DEF(std::shared_ptr<NDataSharing::TStorageSharedBlobsManager>, SharedBlobsManager);
206205
public:
206+
ui64 GetKeepBytes() const {
207+
ui64 size = 0;
208+
for (auto&& i : KeepsToErase) {
209+
size += i.BlobSize();
210+
}
211+
return size;
212+
}
213+
214+
ui64 GetDeleteBytes() const {
215+
ui64 size = 0;
216+
for (TTabletsByBlob::TIterator it(ExtractedToRemoveFromDB); it.IsValid(); ++it) {
217+
size += it.GetBlobId().BlobSize();
218+
}
219+
return size;
220+
}
221+
207222
TGCContext(const std::shared_ptr<NDataSharing::TStorageSharedBlobsManager>& sharedBlobsManager)
208223
: SharedBlobsManager(sharedBlobsManager)
209224
{
@@ -270,11 +285,11 @@ bool TBlobManager::DrainKeepTo(const TGenStep& dest, TGCContext& gcContext) {
270285
if (BlobsToDelete.ExtractBlobTo(keepUnified, gcContext.MutableExtractedToRemoveFromDB())) {
271286
if (logoBlobId.Generation() == CurrentGen) {
272287
AFL_INFO(NKikimrServices::TX_COLUMNSHARD_BLOBS_BS)("to_not_keep", keepUnified.ToStringNew());
273-
continue;
288+
return;
274289
}
275290
if (gcContext.GetSharedBlobsManager()->BuildStoreCategories({ keepUnified }).GetDirect().IsEmpty()) {
276291
AFL_INFO(NKikimrServices::TX_COLUMNSHARD_BLOBS_BS)("to_not_keep_not_direct", keepUnified.ToStringNew());
277-
continue;
292+
return;
278293
}
279294
AFL_INFO(NKikimrServices::TX_COLUMNSHARD_BLOBS_BS)("to_not_keep_old", keepUnified.ToStringNew());
280295
gcContext.MutablePerGroupGCListsInFlight()[bAddress].DontKeepList.insert(logoBlobId);
@@ -284,7 +299,7 @@ bool TBlobManager::DrainKeepTo(const TGenStep& dest, TGCContext& gcContext) {
284299
}
285300
};
286301

287-
return BlobsToKeep.ExtractFront(dest, gcContext.GetFreeSpace(), pred);
302+
return BlobsToKeep.ExtractTo(dest, gcContext.GetFreeSpace(), pred);
288303
}
289304

290305
std::shared_ptr<NBlobOperations::NBlobStorage::TGCTask> TBlobManager::BuildGCTask(const TString& storageId,
@@ -345,12 +360,13 @@ std::shared_ptr<NBlobOperations::NBlobStorage::TGCTask> TBlobManager::BuildGCTas
345360
PreviousGCTime = TInstant::Zero();
346361
}
347362

348-
BlobsManagerCounters.OnGCTask(gcContext.GetKeepsToErase().size(), gcContext.GetExtractedToRemoveFromDB().GetSize(), gcContext.IsFull(), !!CollectGenStepInFlight);
363+
BlobsManagerCounters.GCCounters.OnGCTask(gcContext.GetKeepsToErase().size(), gcContext.GetKeepBytes(),
364+
gcContext.GetExtractedToRemoveFromDB().GetSize(), gcContext.GetDeleteBytes(), gcContext.IsFull(), !!CollectGenStepInFlight);
349365
auto removeCategories = sharedBlobsInfo->BuildRemoveCategories(std::move(gcContext.MutableExtractedToRemoveFromDB()));
350366
auto result = std::make_shared<NBlobOperations::NBlobStorage::TGCTask>(storageId, std::move(gcContext.MutablePerGroupGCListsInFlight()),
351367
CollectGenStepInFlight, std::move(gcContext.MutableKeepsToErase()), manager, std::move(removeCategories), counters, TabletInfo->TabletID, CurrentGen);
352368
if (result->IsEmpty()) {
353-
BlobsManagerCounters.OnEmptyGCTask();
369+
BlobsManagerCounters.GCCounters.OnEmptyGCTask();
354370
CollectGenStepInFlight = {};
355371
return nullptr;
356372
}

ydb/core/tx/columnshard/blobs_action/bs/blob_manager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class TBlobManager : public IBlobManager, public TCommonBlobsTracker {
173173
virtual void DoSaveBlobBatchOnExecute(const TBlobBatch& blobBatch, IBlobManagerDb& db) override;
174174
virtual void DoSaveBlobBatchOnComplete(TBlobBatch&& blobBatch) override;
175175
void DrainDeleteTo(const TGenStep& dest, TGCContext& gcContext);
176-
[[nodiscard]] bool DrainKeepTo(const TGenStep& dest, TGCContext& gcContext, const bool controlCapacity = true);
176+
[[nodiscard]] bool DrainKeepTo(const TGenStep& dest, TGCContext& gcContext);
177177
public:
178178
TBlobManager(TIntrusivePtr<TTabletStorageInfo> tabletInfo, const ui32 gen, const TTabletId selfTabletId);
179179

ydb/core/tx/columnshard/counters/blobs_manager.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ namespace NKikimr::NColumnShard {
77

88
TBlobsManagerCounters::TBlobsManagerCounters(const TString& module)
99
: TCommonCountersOwner(module)
10-
, GCCounters(*this, "GC")
11-
, CurrentGen(TBase::GetValue("CurrentGen"))
12-
, CurrentStep(TBase::GetValue("CurrentStep"))
13-
, BlobsToKeepCount(TBase::GetValue("BlobsToKeep/Count"))
1410
, BlobsToDeleteCount(TBase::GetValue("BlobsToDelete/Count"))
1511
, BlobsToDeleteDelayedCount(TBase::GetValue("BlobsToDeleteDelayed/Count"))
12+
, BlobsToKeepCount(TBase::GetValue("BlobsToKeep/Count"))
13+
, CurrentGen(TBase::GetValue("CurrentGen"))
14+
, CurrentStep(TBase::GetValue("CurrentStep"))
15+
, GCCounters(*this, "GC")
1616

1717
{
1818

1919
}
2020

2121
TBlobsManagerGCCounters::TBlobsManagerGCCounters(const TCommonCountersOwner& sameAs, const TString& componentName)
22-
: TBase(saveAs, componentName)
22+
: TBase(sameAs, componentName)
2323
, SkipCollectionEmpty(TBase::GetDeriviative("Skip/Empty/Count"))
2424
, SkipCollectionThrottling(TBase::GetDeriviative("Skip/Throttling/Count"))
2525
{
@@ -42,11 +42,11 @@ void TBlobsManagerGCCounters::OnGCTask(const ui32 keepsCount, const ui32 keepByt
4242
FullGCTasks->Add(1);
4343
}
4444
KeepsCountTasks->Collect(keepsCount);
45-
KeepsCountBlobs->Collect(keepsCount, keepsCount);
46-
KeepsCountBytes->Collect(keepsCount, keepsBytes);
45+
KeepsCountBlobs->Collect((i64)keepsCount, keepsCount);
46+
KeepsCountBytes->Collect((i64)keepsCount, keepBytes);
4747
DeletesCountTasks->Collect(deleteCount);
48-
DeletesCountBlobs->Collect(deleteCount, deleteCount);
49-
DeletesCountBytes->Collect(keepsCount, deleteBytes);
48+
DeletesCountBlobs->Collect((i64)deleteCount, deleteCount);
49+
DeletesCountBytes->Collect((i64)deleteCount, deleteBytes);
5050
if (moveBarrier) {
5151
MoveBarriers->Add(1);
5252
} else {

ydb/core/tx/columnshard/counters/blobs_manager.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "common/owner.h"
33

44
#include <ydb/core/base/logoblob.h>
5+
#include <ydb/core/tx/columnshard/blobs_action/abstract/blob_set.h>
56
#include <ydb/core/tx/columnshard/blobs_action/abstract/common.h>
67

78
#include <library/cpp/monlib/dynamic_counters/counters.h>
@@ -15,6 +16,7 @@ namespace NKikimr::NColumnShard {
1516

1617
class TBlobsManagerGCCounters: public TCommonCountersOwner {
1718
private:
19+
using TBase = TCommonCountersOwner;
1820
NMonitoring::THistogramPtr KeepsCountBytes;
1921
NMonitoring::THistogramPtr KeepsCountBlobs;
2022
NMonitoring::THistogramPtr KeepsCountTasks;
@@ -32,13 +34,13 @@ class TBlobsManagerGCCounters: public TCommonCountersOwner {
3234

3335
TBlobsManagerGCCounters(const TCommonCountersOwner& sameAs, const TString& componentName);
3436

35-
void OnGCTask(const ui32 keepsCount, const ui32 keepBytes, const ui32 deleteCount, const ui32 deleteBytes,
37+
void OnGCTask(const ui32 keepsCount, const ui32 keepBytes, const ui32 deleteCount, const ui32 deleteBytes,
3638
const bool isFull, const bool moveBarrier) const;
3739

3840
void OnEmptyGCTask() const {
3941
EmptyGCTasks->Add(1);
4042
}
41-
}
43+
};
4244

4345
class TBlobsManagerCounters: public TCommonCountersOwner {
4446
private:
@@ -51,13 +53,13 @@ class TBlobsManagerCounters: public TCommonCountersOwner {
5153
const NMonitoring::TDynamicCounters::TCounterPtr CurrentStep;
5254
const TBlobsManagerGCCounters GCCounters;
5355
TBlobsManagerCounters(const TString& module);
54-
void OnBlobsToDelete(const TTabletsByBlob& blobs) const {
56+
void OnBlobsToDelete(const NOlap::TTabletsByBlob& blobs) const {
5557
BlobsToDeleteCount->Set(blobs.GetSize());
5658
}
57-
void OnBlobsToKeep(const TBlobsByGenStep& blobs) const {
58-
BlobsToKeepCount->Set(blobs.GetBlobsCount());
59+
void OnBlobsToKeep(const NOlap::TBlobsByGenStep& blobs) const {
60+
BlobsToKeepCount->Set(blobs.GetSize());
5961
}
60-
void OnBlobsToDeleteDelayed(const TTabletsByBlob& blobs) const {
62+
void OnBlobsToDeleteDelayed(const NOlap::TTabletsByBlob& blobs) const {
6163
BlobsToDeleteDelayedCount->Set(blobs.GetSize());
6264
}
6365
};

0 commit comments

Comments
 (0)