diff options
author | Evgeniy Ivanov <eivanov89@yandex-team.ru> | 2022-03-18 02:59:10 +0300 |
---|---|---|
committer | Evgeniy Ivanov <eivanov89@yandex-team.ru> | 2022-03-18 02:59:10 +0300 |
commit | 29742ca2d4486c34dd664eaf05731175fe2b30a7 (patch) | |
tree | 6495aedce66d99d54de8cc48c0cee8e43c36c3ca | |
parent | 7531a3b1a493b9cdc57a28f665cef2644c613473 (diff) | |
download | ydb-29742ca2d4486c34dd664eaf05731175fe2b30a7.tar.gz |
KIKIMR-9748: add metric with count of shards having borrowed parts
ref:5b94b1a424e8198ebcc70b0c9184338992ff646f
-rw-r--r-- | ydb/core/protos/counters_schemeshard.proto | 1 | ||||
-rw-r--r-- | ydb/core/tx/schemeshard/schemeshard__compaction.cpp | 9 | ||||
-rw-r--r-- | ydb/core/tx/schemeshard/schemeshard_impl.cpp | 1 | ||||
-rw-r--r-- | ydb/core/tx/schemeshard/schemeshard_impl.h | 1 |
4 files changed, 12 insertions, 0 deletions
diff --git a/ydb/core/protos/counters_schemeshard.proto b/ydb/core/protos/counters_schemeshard.proto index d36819d101..70378fa470 100644 --- a/ydb/core/protos/counters_schemeshard.proto +++ b/ydb/core/protos/counters_schemeshard.proto @@ -153,6 +153,7 @@ enum ESimpleCounters { COUNTER_COMPACTION_QUEUE_SIZE_DELETES = 124 [(CounterOpts) = {Name: "BackgroundCompactionQueueSizeByRowDeletes"}]; COUNTER_COMPACTION_QUEUE_RUNNING = 125 [(CounterOpts) = {Name: "BackgroundCompactionQueueRunning"}]; COUNTER_COMPACTION_QUEUE_WAITING_REPEAT = 126 [(CounterOpts) = {Name: "BackgroundCompactionQueueWaitingRepeat"}]; + COUNTER_SHARDS_WITH_BORROWED_DATA = 127 [(CounterOpts) = {Name: "TableShardsWithBorrowedData"}]; } enum ECumulativeCounters { diff --git a/ydb/core/tx/schemeshard/schemeshard__compaction.cpp b/ydb/core/tx/schemeshard/schemeshard__compaction.cpp index ede0b41653..4d937c2ad4 100644 --- a/ydb/core/tx/schemeshard/schemeshard__compaction.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__compaction.cpp @@ -191,6 +191,12 @@ void TSchemeShard::UpdateShardMetrics( const TShardIdx& shardIdx, const TTableInfo::TPartitionStats& newStats) { + if (newStats.HasBorrowed) + ShardsWithBorrowed.insert(shardIdx); + else + ShardsWithBorrowed.erase(shardIdx); + TabletCounters->Simple()[COUNTER_SHARDS_WITH_BORROWED_DATA].Set(ShardsWithBorrowed.size()); + THashMap<TShardIdx, TPartitionMetrics>::insert_ctx insertCtx; auto it = PartitionMetricsMap.find(shardIdx, insertCtx); if (it != PartitionMetricsMap.end()) { @@ -221,6 +227,9 @@ void TSchemeShard::UpdateShardMetrics( } void TSchemeShard::RemoveShardMetrics(const TShardIdx& shardIdx) { + ShardsWithBorrowed.erase(shardIdx); + TabletCounters->Simple()[COUNTER_SHARDS_WITH_BORROWED_DATA].Set(ShardsWithBorrowed.size()); + auto it = PartitionMetricsMap.find(shardIdx); if (it == PartitionMetricsMap.end()) return; diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.cpp b/ydb/core/tx/schemeshard/schemeshard_impl.cpp index 9517f67b87..5053932b6c 100644 --- a/ydb/core/tx/schemeshard/schemeshard_impl.cpp +++ b/ydb/core/tx/schemeshard/schemeshard_impl.cpp @@ -289,6 +289,7 @@ void TSchemeShard::Clear() { CompactionQueue->Clear(); UpdateBackgroundCompactionQueueMetrics(); } + ShardsWithBorrowed.clear(); PersQueueGroups.clear(); RtmrVolumes.clear(); SubDomains.clear(); diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.h b/ydb/core/tx/schemeshard/schemeshard_impl.h index 30fcdc9e9d..80713005be 100644 --- a/ydb/core/tx/schemeshard/schemeshard_impl.h +++ b/ydb/core/tx/schemeshard/schemeshard_impl.h @@ -205,6 +205,7 @@ public: TCompactionStarter CompactionStarter; TCompactionQueue* CompactionQueue = nullptr; + THashSet<TShardIdx> ShardsWithBorrowed; bool EnableBackgroundCompaction = false; bool EnableBackgroundCompactionServerless = false; |