Skip to content

Commit dd8c3d7

Browse files
authored
Merge f069a43 into 8fefc80
2 parents 8fefc80 + f069a43 commit dd8c3d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+739
-329
lines changed

ydb/core/protos/counters_columnshard.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ enum ECumulativeCounters {
135135
COUNTER_READING_EXPORTED_BLOBS = 79 [(CounterOpts) = {Name: "ReadingExportedBlobs"}];
136136
COUNTER_READING_EXPORTED_BYTES = 80 [(CounterOpts) = {Name: "ReadingExportedBytes"}];
137137
COUNTER_READING_EXPORTED_RANGES = 81 [(CounterOpts) = {Name: "ReadingExportedRanges"}];
138+
COUNTER_PLANNED_TX_COMPLETED = 82 [(CounterOpts) = {Name: "PlannedTxCompleted"}];
139+
COUNTER_IMMEDIATE_TX_COMPLETED = 83 [(CounterOpts) = {Name: "ImmediateTxCompleted"}];
138140
}
139141

140142
enum EPercentileCounters {

ydb/core/tx/columnshard/background_controller.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22
#include "engines/changes/abstract/compaction_info.h"
33
#include "engines/portions/meta.h"
4+
#include <ydb/core/tx/columnshard/counters/counters_manager.h>
45

56
namespace NKikimr::NOlap {
67
class TColumnEngineChanges;
@@ -15,11 +16,16 @@ class TBackgroundController {
1516
using TCurrentCompaction = THashMap<ui64, NOlap::TPlanCompactionInfo>;
1617
TCurrentCompaction ActiveCompactionInfo;
1718

19+
std::shared_ptr<TBackgroundControllerCounters> Counters;
1820
bool ActiveCleanupPortions = false;
1921
bool ActiveCleanupTables = false;
2022
bool ActiveCleanupInsertTable = false;
2123
YDB_READONLY(TMonotonic, LastIndexationInstant, TMonotonic::Zero());
2224
public:
25+
TBackgroundController(std::shared_ptr<TBackgroundControllerCounters> counters)
26+
: Counters(std::move(counters)) {
27+
}
28+
2329
THashSet<NOlap::TPortionAddress> GetConflictTTLPortions() const;
2430
THashSet<NOlap::TPortionAddress> GetConflictCompactionPortions() const;
2531

@@ -29,6 +35,7 @@ class TBackgroundController {
2935
bool StartCompaction(const NOlap::TPlanCompactionInfo& info);
3036
void FinishCompaction(const NOlap::TPlanCompactionInfo& info) {
3137
Y_ABORT_UNLESS(ActiveCompactionInfo.erase(info.GetPathId()));
38+
Counters->OnCompactionFinish(info.GetPathId());
3239
}
3340
const TCurrentCompaction& GetActiveCompaction() const {
3441
return ActiveCompactionInfo;

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,10 @@ void TWriteAction::DoOnCompleteTxAfterWrite(NColumnShard::TColumnShard& self, co
1515
ui64 blobsWritten = BlobBatch.GetBlobCount();
1616
ui64 bytesWritten = BlobBatch.GetTotalSize();
1717
if (blobsWroteSuccessfully) {
18-
self.IncCounter(NColumnShard::COUNTER_UPSERT_BLOBS_WRITTEN, blobsWritten);
19-
self.IncCounter(NColumnShard::COUNTER_UPSERT_BYTES_WRITTEN, bytesWritten);
20-
// self.IncCounter(NColumnShard::COUNTER_RAW_BYTES_UPSERTED, insertedBytes);
21-
self.IncCounter(NColumnShard::COUNTER_WRITE_SUCCESS);
18+
self.Counters.GetTabletCounters()->OnWriteSuccess(blobsWritten, bytesWritten);
2219
Manager->SaveBlobBatchOnComplete(std::move(BlobBatch));
2320
} else {
24-
self.IncCounter(NColumnShard::COUNTER_WRITE_FAIL);
21+
self.Counters.GetTabletCounters()->OnWriteFailure();
2522
}
2623
}
2724

ydb/core/tx/columnshard/blobs_action/transaction/tx_write.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ bool TTxWrite::Execute(TTransactionContext& txc, const TActorContext&) {
7070

7171
if (!InsertOneBlob(txc, i, writeId)) {
7272
LOG_S_DEBUG(TxPrefix() << "duplicate writeId " << (ui64)writeId << TxSuffix());
73-
Self->IncCounter(COUNTER_WRITE_DUPLICATE);
73+
Self->Counters.GetTabletCounters()->IncCounter(COUNTER_WRITE_DUPLICATE);
7474
}
7575
}
7676
}
@@ -140,10 +140,10 @@ void TTxWrite::Complete(const TActorContext& ctx) {
140140
}
141141
for (ui32 i = 0; i < buffer.GetAggregations().size(); ++i) {
142142
const auto& writeMeta = buffer.GetAggregations()[i]->GetWriteMeta();
143-
Self->CSCounters.OnWriteTxComplete(now - writeMeta.GetWriteStartInstant());
144-
Self->CSCounters.OnSuccessWriteResponse();
143+
Self->Counters.GetCSCounters().OnWriteTxComplete(now - writeMeta.GetWriteStartInstant());
144+
Self->Counters.GetCSCounters().OnSuccessWriteResponse();
145145
}
146-
146+
Self->Counters.GetTabletCounters()->IncCounter(COUNTER_IMMEDIATE_TX_COMPLETED);
147147
}
148148

149149
}

ydb/core/tx/columnshard/columnshard.cpp

Lines changed: 81 additions & 97 deletions
Large diffs are not rendered by default.

ydb/core/tx/columnshard/columnshard__init.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ bool TTxInit::ReadEverything(TTransactionContext& txc, const TActorContext& ctx)
165165
}
166166
Self->TablesManager = std::move(tManagerLocal);
167167

168-
Self->SetCounter(COUNTER_TABLES, Self->TablesManager.GetTables().size());
169-
Self->SetCounter(COUNTER_TABLE_PRESETS, Self->TablesManager.GetSchemaPresets().size());
170-
Self->SetCounter(COUNTER_TABLE_TTLS, Self->TablesManager.GetTtl().PathsCount());
168+
Self->Counters.GetTabletCounters()->SetCounter(COUNTER_TABLES, Self->TablesManager.GetTables().size());
169+
Self->Counters.GetTabletCounters()->SetCounter(COUNTER_TABLE_PRESETS, Self->TablesManager.GetSchemaPresets().size());
170+
Self->Counters.GetTabletCounters()->SetCounter(COUNTER_TABLE_TTLS, Self->TablesManager.GetTtl().PathsCount());
171171
ACFL_DEBUG("step", "TTablesManager::Load_Finish");
172172
}
173173

ydb/core/tx/columnshard/columnshard__plan_step.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ bool TTxPlanStep::Execute(TTransactionContext& txc, const TActorContext& ctx) {
102102

103103
Result = std::make_unique<TEvTxProcessing::TEvPlanStepAccepted>(Self->TabletID(), step);
104104

105-
Self->IncCounter(COUNTER_PLAN_STEP_ACCEPTED);
105+
Self->Counters.GetTabletCounters()->IncCounter(COUNTER_PLAN_STEP_ACCEPTED);
106106

107107
if (plannedCount > 0 || Self->ProgressTxController->HaveOutdatedTxs()) {
108108
Self->EnqueueProgressTx(ctx);

ydb/core/tx/columnshard/columnshard__progress_tx.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class TColumnShard::TTxProgressTx : public TTransactionBase<TColumnShard> {
1818
bool Execute(TTransactionContext& txc, const TActorContext& ctx) override {
1919
NActors::TLogContextGuard logGuard = NActors::TLogContextBuilder::Build(NKikimrServices::TX_COLUMNSHARD)("tablet_id", Self->TabletID())("tx_state", "execute");
2020
Y_ABORT_UNLESS(Self->ProgressTxInFlight);
21-
Self->TabletCounters->Simple()[COUNTER_TX_COMPLETE_LAG].Set(Self->GetTxCompleteLag().MilliSeconds());
21+
Self->Counters.GetTabletCounters()->SetCounter(COUNTER_TX_COMPLETE_LAG, Self->GetTxCompleteLag().MilliSeconds());
2222

2323
const size_t removedCount = Self->ProgressTxController->CleanExpiredTxs(txc);
2424
if (removedCount > 0) {
@@ -43,6 +43,7 @@ class TColumnShard::TTxProgressTx : public TTransactionBase<TColumnShard> {
4343
TxOperator = Self->ProgressTxController->GetVerifiedTxOperator(txId);
4444
AFL_VERIFY(TxOperator->ProgressOnExecute(*Self, NOlap::TSnapshot(step, txId), txc));
4545
Self->ProgressTxController->FinishPlannedTx(txId, txc);
46+
Self->Counters.GetTabletCounters()->IncCounter(COUNTER_PLANNED_TX_COMPLETED);
4647
}
4748
return true;
4849
}

ydb/core/tx/columnshard/columnshard__propose_transaction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class TTxProposeTransaction: public NTabletFlatExecutor::TTransactionBase<TColum
2525
txc.DB.NoMoreReadsForTx();
2626
NIceDb::TNiceDb db(txc.DB);
2727

28-
Self->IncCounter(COUNTER_PREPARE_REQUEST);
28+
Self->Counters.GetTabletCounters()->IncCounter(COUNTER_PREPARE_REQUEST);
2929

3030
auto& record = Proto(Ev->Get());
3131
const auto txKind = record.GetTxKind();

ydb/core/tx/columnshard/columnshard__scan.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "engines/reader/transaction/tx_internal_scan.h"
66

77
#include <ydb/core/protos/kqp.pb.h>
8+
#include <ydb/core/base/appdata_fwd.h>
89

910
namespace NKikimr::NColumnShard {
1011

@@ -29,9 +30,9 @@ void TColumnShard::Handle(TEvColumnShard::TEvScan::TPtr& ev, const TActorContext
2930
return;
3031
}
3132

32-
LastAccessTime = TAppData::TimeProvider->Now();
33-
ScanTxInFlight.insert({txId, LastAccessTime});
34-
SetCounter(COUNTER_SCAN_IN_FLY, ScanTxInFlight.size());
33+
Counters.GetColumnTablesCounters()->GetPathIdCounter(record.GetLocalPathId())->OnAccess();
34+
ScanTxInFlight.insert({txId, TAppData::TimeProvider->Now()});
35+
Counters.GetTabletCounters()->SetCounter(COUNTER_SCAN_IN_FLY, ScanTxInFlight.size());
3536
Execute(new NOlap::NReader::TTxScan(this, ev), ctx);
3637
}
3738

0 commit comments

Comments
 (0)