aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorivanmorozov <ivanmorozov@yandex-team.com>2023-05-26 12:39:43 +0300
committerivanmorozov <ivanmorozov@yandex-team.com>2023-05-26 12:39:43 +0300
commit5fb56f57a2faaabc078104d574e7c90efba079a0 (patch)
treeb1c981f4507556a57e13cde673399c813a318a7c
parenta5318d6074b80c543dc43f72eee1cb9d883a44c6 (diff)
downloadydb-5fb56f57a2faaabc078104d574e7c90efba079a0.tar.gz
counters for compaction-class-processes
-rw-r--r--ydb/core/tx/columnshard/CMakeLists.darwin-x86_64.txt2
-rw-r--r--ydb/core/tx/columnshard/CMakeLists.linux-aarch64.txt2
-rw-r--r--ydb/core/tx/columnshard/CMakeLists.linux-x86_64.txt2
-rw-r--r--ydb/core/tx/columnshard/CMakeLists.windows-x86_64.txt2
-rw-r--r--ydb/core/tx/columnshard/columnshard.cpp6
-rw-r--r--ydb/core/tx/columnshard/columnshard_impl.h16
-rw-r--r--ydb/core/tx/columnshard/compaction_actor.cpp26
-rw-r--r--ydb/core/tx/columnshard/counters.cpp33
-rw-r--r--ydb/core/tx/columnshard/counters.h35
-rw-r--r--ydb/core/tx/columnshard/counters/CMakeLists.darwin-x86_64.txt20
-rw-r--r--ydb/core/tx/columnshard/counters/CMakeLists.linux-aarch64.txt21
-rw-r--r--ydb/core/tx/columnshard/counters/CMakeLists.linux-x86_64.txt21
-rw-r--r--ydb/core/tx/columnshard/counters/CMakeLists.txt17
-rw-r--r--ydb/core/tx/columnshard/counters/CMakeLists.windows-x86_64.txt20
-rw-r--r--ydb/core/tx/columnshard/counters/indexation.cpp30
-rw-r--r--ydb/core/tx/columnshard/counters/indexation.h29
-rw-r--r--ydb/core/tx/columnshard/counters/scan.cpp34
-rw-r--r--ydb/core/tx/columnshard/counters/scan.h33
-rw-r--r--ydb/core/tx/columnshard/engines/column_engine_logs.cpp6
-rw-r--r--ydb/core/tx/columnshard/engines/index_logic_logs.cpp20
-rw-r--r--ydb/core/tx/columnshard/engines/index_logic_logs.h9
-rw-r--r--ydb/core/tx/columnshard/engines/portion_info.cpp6
-rw-r--r--ydb/core/tx/columnshard/engines/portion_info.h2
-rw-r--r--ydb/core/tx/columnshard/engines/ut/CMakeLists.darwin-x86_64.txt1
-rw-r--r--ydb/core/tx/columnshard/engines/ut/CMakeLists.linux-aarch64.txt1
-rw-r--r--ydb/core/tx/columnshard/engines/ut/CMakeLists.linux-x86_64.txt1
-rw-r--r--ydb/core/tx/columnshard/engines/ut/CMakeLists.windows-x86_64.txt1
-rw-r--r--ydb/core/tx/columnshard/engines/ut_logs_engine.cpp4
-rw-r--r--ydb/core/tx/columnshard/eviction_actor.cpp14
-rw-r--r--ydb/core/tx/columnshard/indexing_actor.cpp14
30 files changed, 323 insertions, 105 deletions
diff --git a/ydb/core/tx/columnshard/CMakeLists.darwin-x86_64.txt b/ydb/core/tx/columnshard/CMakeLists.darwin-x86_64.txt
index cf3965f92e3..4cc3c30463a 100644
--- a/ydb/core/tx/columnshard/CMakeLists.darwin-x86_64.txt
+++ b/ydb/core/tx/columnshard/CMakeLists.darwin-x86_64.txt
@@ -6,6 +6,7 @@
# original buildsystem will not be accepted.
+add_subdirectory(counters)
add_subdirectory(engines)
add_subdirectory(ut_rw)
add_subdirectory(ut_schema)
@@ -35,6 +36,7 @@ target_link_libraries(core-tx-columnshard PUBLIC
ydb-core-tablet
ydb-core-tablet_flat
tx-columnshard-engines
+ tx-columnshard-counters
core-tx-tiering
tx-conveyor-usage
tx-long_tx_service-public
diff --git a/ydb/core/tx/columnshard/CMakeLists.linux-aarch64.txt b/ydb/core/tx/columnshard/CMakeLists.linux-aarch64.txt
index 18548811263..e044cc71d3e 100644
--- a/ydb/core/tx/columnshard/CMakeLists.linux-aarch64.txt
+++ b/ydb/core/tx/columnshard/CMakeLists.linux-aarch64.txt
@@ -6,6 +6,7 @@
# original buildsystem will not be accepted.
+add_subdirectory(counters)
add_subdirectory(engines)
add_subdirectory(ut_rw)
add_subdirectory(ut_schema)
@@ -36,6 +37,7 @@ target_link_libraries(core-tx-columnshard PUBLIC
ydb-core-tablet
ydb-core-tablet_flat
tx-columnshard-engines
+ tx-columnshard-counters
core-tx-tiering
tx-conveyor-usage
tx-long_tx_service-public
diff --git a/ydb/core/tx/columnshard/CMakeLists.linux-x86_64.txt b/ydb/core/tx/columnshard/CMakeLists.linux-x86_64.txt
index 18548811263..e044cc71d3e 100644
--- a/ydb/core/tx/columnshard/CMakeLists.linux-x86_64.txt
+++ b/ydb/core/tx/columnshard/CMakeLists.linux-x86_64.txt
@@ -6,6 +6,7 @@
# original buildsystem will not be accepted.
+add_subdirectory(counters)
add_subdirectory(engines)
add_subdirectory(ut_rw)
add_subdirectory(ut_schema)
@@ -36,6 +37,7 @@ target_link_libraries(core-tx-columnshard PUBLIC
ydb-core-tablet
ydb-core-tablet_flat
tx-columnshard-engines
+ tx-columnshard-counters
core-tx-tiering
tx-conveyor-usage
tx-long_tx_service-public
diff --git a/ydb/core/tx/columnshard/CMakeLists.windows-x86_64.txt b/ydb/core/tx/columnshard/CMakeLists.windows-x86_64.txt
index cf3965f92e3..4cc3c30463a 100644
--- a/ydb/core/tx/columnshard/CMakeLists.windows-x86_64.txt
+++ b/ydb/core/tx/columnshard/CMakeLists.windows-x86_64.txt
@@ -6,6 +6,7 @@
# original buildsystem will not be accepted.
+add_subdirectory(counters)
add_subdirectory(engines)
add_subdirectory(ut_rw)
add_subdirectory(ut_schema)
@@ -35,6 +36,7 @@ target_link_libraries(core-tx-columnshard PUBLIC
ydb-core-tablet
ydb-core-tablet_flat
tx-columnshard-engines
+ tx-columnshard-counters
core-tx-tiering
tx-conveyor-usage
tx-long_tx_service-public
diff --git a/ydb/core/tx/columnshard/columnshard.cpp b/ydb/core/tx/columnshard/columnshard.cpp
index a302eabc4e5..dfb3f88835d 100644
--- a/ydb/core/tx/columnshard/columnshard.cpp
+++ b/ydb/core/tx/columnshard/columnshard.cpp
@@ -26,12 +26,12 @@ void TColumnShard::SwitchToWork(const TActorContext& ctx) {
Become(&TThis::StateWork);
LOG_S_INFO("Switched to work at " << TabletID() << " actor " << ctx.SelfID);
- IndexingActor = ctx.Register(CreateIndexingActor(TabletID(), ctx.SelfID));
+ IndexingActor = ctx.Register(CreateIndexingActor(TabletID(), ctx.SelfID, IndexationCounters));
CompactionActor = ctx.Register(
- CreateCompactionActor(TabletID(), ctx.SelfID, TSettings::MAX_ACTIVE_COMPACTIONS),
+ CreateCompactionActor(TabletID(), ctx.SelfID, TSettings::MAX_ACTIVE_COMPACTIONS, CompactionCounters),
// Default mail-box and batch pool.
TMailboxType::HTSwap, AppData(ctx)->BatchPoolId);
- EvictionActor = ctx.Register(CreateEvictionActor(TabletID(), ctx.SelfID));
+ EvictionActor = ctx.Register(CreateEvictionActor(TabletID(), ctx.SelfID, EvictionCounters));
for (auto&& i : TablesManager.GetTables()) {
ActivateTiering(i.first, i.second.GetTieringUsage());
}
diff --git a/ydb/core/tx/columnshard/columnshard_impl.h b/ydb/core/tx/columnshard/columnshard_impl.h
index 8ebf8d9a29d..7c3788993c7 100644
--- a/ydb/core/tx/columnshard/columnshard_impl.h
+++ b/ydb/core/tx/columnshard/columnshard_impl.h
@@ -24,9 +24,9 @@ namespace NKikimr::NColumnShard {
extern bool gAllowLogBatchingDefaultValue;
-IActor* CreateIndexingActor(ui64 tabletId, const TActorId& parent);
-IActor* CreateCompactionActor(ui64 tabletId, const TActorId& parent, const ui64 workers);
-IActor* CreateEvictionActor(ui64 tabletId, const TActorId& parent);
+IActor* CreateIndexingActor(ui64 tabletId, const TActorId& parent, const TIndexationCounters& counters);
+IActor* CreateCompactionActor(ui64 tabletId, const TActorId& parent, const ui64 workers, const TIndexationCounters& counters);
+IActor* CreateEvictionActor(ui64 tabletId, const TActorId& parent, const TIndexationCounters& counters);
IActor* CreateWriteActor(ui64 tabletId, const NOlap::TIndexInfo& indexTable,
const TActorId& dstActor, TBlobBatch&& blobBatch, bool blobGrouppingEnabled,
TAutoPtr<TEvColumnShard::TEvWrite> ev, const TInstant& deadline = TInstant::Max());
@@ -44,7 +44,7 @@ IActor* CreateColumnShardScan(const TActorId& scanComputeActor, ui32 scanId, ui6
IActor* CreateExportActor(const ui64 tabletId, const TActorId& dstActor, TAutoPtr<TEvPrivate::TEvExport> ev);
struct TSettings {
- static constexpr ui32 MAX_ACTIVE_COMPACTIONS = 2;
+ static constexpr ui32 MAX_ACTIVE_COMPACTIONS = 1;
static constexpr ui32 MAX_INDEXATIONS_TO_SKIP = 16;
@@ -381,8 +381,12 @@ private:
std::unique_ptr<NTabletPipe::IClientCache> PipeClientCache;
std::unique_ptr<NOlap::TInsertTable> InsertTable;
TBatchCache BatchCache;
- TScanCounters ReadCounters;
- TScanCounters ScanCounters;
+ const TScanCounters ReadCounters;
+ const TScanCounters ScanCounters;
+ const TIndexationCounters IndexationCounters = TIndexationCounters("Indexation");
+ const TIndexationCounters CompactionCounters = TIndexationCounters("Compaction");
+ const TIndexationCounters EvictionCounters = TIndexationCounters("Eviction");
+
THashMap<ui64, TBasicTxInfo> BasicTxInfo;
TSet<TDeadlineQueueItem> DeadlineQueue;
diff --git a/ydb/core/tx/columnshard/compaction_actor.cpp b/ydb/core/tx/columnshard/compaction_actor.cpp
index 74c350b5b17..ea6cc4d3663 100644
--- a/ydb/core/tx/columnshard/compaction_actor.cpp
+++ b/ydb/core/tx/columnshard/compaction_actor.cpp
@@ -10,13 +10,16 @@ namespace NKikimr::NColumnShard {
namespace {
class TCompactionActor: public TActorBootstrapped<TCompactionActor> {
+private:
+ const TIndexationCounters Counters;
public:
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
return NKikimrServices::TActivity::TX_COLUMNSHARD_COMPACTION_ACTOR;
}
- TCompactionActor(ui64 tabletId, const TActorId& parent)
- : TabletId(tabletId)
+ TCompactionActor(ui64 tabletId, const TActorId& parent, const TIndexationCounters& counters)
+ : Counters(counters)
+ , TabletId(tabletId)
, Parent(parent)
, BlobCacheActorId(NBlobCache::MakeBlobCacheServiceId()) {
}
@@ -41,6 +44,7 @@ public:
for (const auto& blobRange : ranges) {
Y_VERIFY(blobId == blobRange.BlobId);
Blobs[blobRange] = {};
+ Counters.ReadBytes->Add(blobRange.Size);
}
SendReadRequest(std::move(ranges), event.Externals.contains(blobId));
}
@@ -130,7 +134,7 @@ private:
TxEvent->IndexChanges->SetBlobs(std::move(Blobs));
- NOlap::TCompactionLogic compactionLogic(TxEvent->IndexInfo, TxEvent->Tiering);
+ NOlap::TCompactionLogic compactionLogic(TxEvent->IndexInfo, TxEvent->Tiering, Counters);
TxEvent->Blobs = compactionLogic.Apply(TxEvent->IndexChanges);
if (TxEvent->Blobs.empty()) {
TxEvent->PutStatus = NKikimrProto::OK; // nothing to write, commit
@@ -146,22 +150,26 @@ private:
};
class TCompactionGroupActor: public TActorBootstrapped<TCompactionGroupActor> {
+private:
+ const TIndexationCounters Counters;
public:
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
return NKikimrServices::TActivity::TX_COLUMNSHARD_COMPACTION_ACTOR;
}
- TCompactionGroupActor(ui64 tabletId, const TActorId& parent, const ui64 size)
- : TabletId(tabletId)
+ TCompactionGroupActor(ui64 tabletId, const TActorId& parent, const ui64 size, const TIndexationCounters& counters)
+ : Counters(counters)
+ , TabletId(tabletId)
, Parent(parent)
- , Idle(size == 0 ? 1 : size) {
+ , Idle(size == 0 ? 1 : size)
+ {
}
void Bootstrap(const TActorContext& ctx) {
Become(&TThis::StateWait);
for (auto& worker : Idle) {
- worker = ctx.Register(new TCompactionActor(TabletId, ctx.SelfID));
+ worker = ctx.Register(new TCompactionActor(TabletId, ctx.SelfID, Counters));
}
}
@@ -217,8 +225,8 @@ private:
} // namespace
-IActor* CreateCompactionActor(ui64 tabletId, const TActorId& parent, const ui64 workers) {
- return new TCompactionGroupActor(tabletId, parent, workers);
+IActor* CreateCompactionActor(ui64 tabletId, const TActorId& parent, const ui64 workers, const TIndexationCounters& counters) {
+ return new TCompactionGroupActor(tabletId, parent, workers, counters);
}
} // namespace NKikimr::NColumnShard
diff --git a/ydb/core/tx/columnshard/counters.cpp b/ydb/core/tx/columnshard/counters.cpp
index 5a11fad76ed..caddba0e047 100644
--- a/ydb/core/tx/columnshard/counters.cpp
+++ b/ydb/core/tx/columnshard/counters.cpp
@@ -1,34 +1 @@
#include "counters.h"
-#include <ydb/core/base/appdata.h>
-#include <ydb/core/base/counters.h>
-
-namespace NKikimr::NColumnShard {
-
-TScanCounters::TScanCounters(const TString& module) {
- ::NMonitoring::TDynamicCounterPtr subGroup = GetServiceCounters(AppData()->Counters, "tablets")->GetSubgroup("subsystem", "columnshard");
-
- PortionBytes = subGroup->GetCounter(module + "/PortionBytes", true);
- FilterBytes = subGroup->GetCounter(module + "/FilterBytes", true);
- PostFilterBytes = subGroup->GetCounter(module + "/PostFilterBytes", true);
-
- AssembleFilterCount = subGroup->GetCounter(module + "/AssembleFilterCount", true);
-
- FilterOnlyCount = subGroup->GetCounter(module + "/FilterOnlyCount", true);
- FilterOnlyFetchedBytes = subGroup->GetCounter(module + "/FilterOnlyFetchedBytes", true);
- FilterOnlyUsefulBytes = subGroup->GetCounter(module + "/FilterOnlyUsefulBytes", true);
-
- EmptyFilterCount = subGroup->GetCounter(module + "/EmptyFilterCount", true);
- EmptyFilterFetchedBytes = subGroup->GetCounter(module + "/EmptyFilterFetchedBytes", true);
-
- OriginalRowsCount = subGroup->GetCounter(module + "/OriginalRowsCount", true);
- FilteredRowsCount = subGroup->GetCounter(module + "/FilteredRowsCount", true);
- SkippedBytes = subGroup->GetCounter(module + "/SkippedBytes", true);
-
- TwoPhasesCount = subGroup->GetCounter(module + "/TwoPhasesCount", true);
- TwoPhasesFilterFetchedBytes = subGroup->GetCounter(module + "/TwoPhasesFilterFetchedBytes", true);
- TwoPhasesFilterUsefulBytes = subGroup->GetCounter(module + "/TwoPhasesFilterUsefulBytes", true);
- TwoPhasesPostFilterFetchedBytes = subGroup->GetCounter(module + "/TwoPhasesPostFilterFetchedBytes", true);
- TwoPhasesPostFilterUsefulBytes = subGroup->GetCounter(module + "/TwoPhasesPostFilterUsefulBytes", true);
-}
-
-}
diff --git a/ydb/core/tx/columnshard/counters.h b/ydb/core/tx/columnshard/counters.h
index f9875de8f7f..558b8ec4a2d 100644
--- a/ydb/core/tx/columnshard/counters.h
+++ b/ydb/core/tx/columnshard/counters.h
@@ -1,34 +1,3 @@
#pragma once
-#include <library/cpp/monlib/dynamic_counters/counters.h>
-#include <ydb/library/accessor/accessor.h>
-
-namespace NKikimr::NColumnShard {
-
-struct TScanCounters {
- NMonitoring::TDynamicCounters::TCounterPtr PortionBytes;
- NMonitoring::TDynamicCounters::TCounterPtr FilterBytes;
- NMonitoring::TDynamicCounters::TCounterPtr PostFilterBytes;
-
- NMonitoring::TDynamicCounters::TCounterPtr AssembleFilterCount;
-
- NMonitoring::TDynamicCounters::TCounterPtr FilterOnlyCount;
- NMonitoring::TDynamicCounters::TCounterPtr FilterOnlyFetchedBytes;
- NMonitoring::TDynamicCounters::TCounterPtr FilterOnlyUsefulBytes;
-
- NMonitoring::TDynamicCounters::TCounterPtr EmptyFilterCount;
- NMonitoring::TDynamicCounters::TCounterPtr EmptyFilterFetchedBytes;
-
- NMonitoring::TDynamicCounters::TCounterPtr OriginalRowsCount;
- NMonitoring::TDynamicCounters::TCounterPtr FilteredRowsCount;
- NMonitoring::TDynamicCounters::TCounterPtr SkippedBytes;
-
- NMonitoring::TDynamicCounters::TCounterPtr TwoPhasesCount;
- NMonitoring::TDynamicCounters::TCounterPtr TwoPhasesFilterFetchedBytes;
- NMonitoring::TDynamicCounters::TCounterPtr TwoPhasesFilterUsefulBytes;
- NMonitoring::TDynamicCounters::TCounterPtr TwoPhasesPostFilterFetchedBytes;
- NMonitoring::TDynamicCounters::TCounterPtr TwoPhasesPostFilterUsefulBytes;
-
- TScanCounters(const TString& module = "Scan");
-};
-
-}
+#include "counters/scan.h"
+#include "counters/indexation.h"
diff --git a/ydb/core/tx/columnshard/counters/CMakeLists.darwin-x86_64.txt b/ydb/core/tx/columnshard/counters/CMakeLists.darwin-x86_64.txt
new file mode 100644
index 00000000000..9632aa025cd
--- /dev/null
+++ b/ydb/core/tx/columnshard/counters/CMakeLists.darwin-x86_64.txt
@@ -0,0 +1,20 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_library(tx-columnshard-counters)
+target_link_libraries(tx-columnshard-counters PUBLIC
+ contrib-libs-cxxsupp
+ yutil
+ cpp-monlib-dynamic_counters
+ ydb-core-base
+)
+target_sources(tx-columnshard-counters PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/counters/indexation.cpp
+ ${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/counters/scan.cpp
+)
diff --git a/ydb/core/tx/columnshard/counters/CMakeLists.linux-aarch64.txt b/ydb/core/tx/columnshard/counters/CMakeLists.linux-aarch64.txt
new file mode 100644
index 00000000000..6efe68a4243
--- /dev/null
+++ b/ydb/core/tx/columnshard/counters/CMakeLists.linux-aarch64.txt
@@ -0,0 +1,21 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_library(tx-columnshard-counters)
+target_link_libraries(tx-columnshard-counters PUBLIC
+ contrib-libs-linux-headers
+ contrib-libs-cxxsupp
+ yutil
+ cpp-monlib-dynamic_counters
+ ydb-core-base
+)
+target_sources(tx-columnshard-counters PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/counters/indexation.cpp
+ ${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/counters/scan.cpp
+)
diff --git a/ydb/core/tx/columnshard/counters/CMakeLists.linux-x86_64.txt b/ydb/core/tx/columnshard/counters/CMakeLists.linux-x86_64.txt
new file mode 100644
index 00000000000..6efe68a4243
--- /dev/null
+++ b/ydb/core/tx/columnshard/counters/CMakeLists.linux-x86_64.txt
@@ -0,0 +1,21 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_library(tx-columnshard-counters)
+target_link_libraries(tx-columnshard-counters PUBLIC
+ contrib-libs-linux-headers
+ contrib-libs-cxxsupp
+ yutil
+ cpp-monlib-dynamic_counters
+ ydb-core-base
+)
+target_sources(tx-columnshard-counters PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/counters/indexation.cpp
+ ${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/counters/scan.cpp
+)
diff --git a/ydb/core/tx/columnshard/counters/CMakeLists.txt b/ydb/core/tx/columnshard/counters/CMakeLists.txt
new file mode 100644
index 00000000000..f8b31df0c11
--- /dev/null
+++ b/ydb/core/tx/columnshard/counters/CMakeLists.txt
@@ -0,0 +1,17 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND NOT HAVE_CUDA)
+ include(CMakeLists.linux-aarch64.txt)
+elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ include(CMakeLists.darwin-x86_64.txt)
+elseif (WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64" AND NOT HAVE_CUDA)
+ include(CMakeLists.windows-x86_64.txt)
+elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND NOT HAVE_CUDA)
+ include(CMakeLists.linux-x86_64.txt)
+endif()
diff --git a/ydb/core/tx/columnshard/counters/CMakeLists.windows-x86_64.txt b/ydb/core/tx/columnshard/counters/CMakeLists.windows-x86_64.txt
new file mode 100644
index 00000000000..9632aa025cd
--- /dev/null
+++ b/ydb/core/tx/columnshard/counters/CMakeLists.windows-x86_64.txt
@@ -0,0 +1,20 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_library(tx-columnshard-counters)
+target_link_libraries(tx-columnshard-counters PUBLIC
+ contrib-libs-cxxsupp
+ yutil
+ cpp-monlib-dynamic_counters
+ ydb-core-base
+)
+target_sources(tx-columnshard-counters PRIVATE
+ ${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/counters/indexation.cpp
+ ${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/counters/scan.cpp
+)
diff --git a/ydb/core/tx/columnshard/counters/indexation.cpp b/ydb/core/tx/columnshard/counters/indexation.cpp
new file mode 100644
index 00000000000..f2de68ebee0
--- /dev/null
+++ b/ydb/core/tx/columnshard/counters/indexation.cpp
@@ -0,0 +1,30 @@
+#include "indexation.h"
+#include <ydb/core/base/appdata.h>
+#include <ydb/core/base/counters.h>
+
+namespace NKikimr::NColumnShard {
+
+TIndexationCounters::TIndexationCounters(const TString& module) {
+ if (NActors::TlsActivationContext) {
+ SubGroup = GetServiceCounters(AppData()->Counters, "tablets")->GetSubgroup("subsystem", "columnshard");
+ } else {
+ SubGroup = new NMonitoring::TDynamicCounters();
+ }
+ ReadBytes = SubGroup->GetCounter(module + "/ReadBytes", true);
+ AnalizeCompactedPortions = SubGroup->GetCounter(module + "/AnalizeCompactedPortions", true);
+ AnalizeInsertedPortions = SubGroup->GetCounter(module + "/AnalizeInsertedPortions", true);
+ RepackedInsertedPortions = SubGroup->GetCounter(module + "/RepackedInsertedPortions", true);
+ RepackedInsertedPortionBytes = SubGroup->GetCounter(module + "/RepackedInsertedPortionBytes", true);
+ SkipPortionsMoveThroughIntersection = SubGroup->GetCounter(module + "/SkipPortionsMoveThroughIntersection", true);
+ SkipPortionBytesMoveThroughIntersection = SubGroup->GetCounter(module + "/SkipPortionBytesMoveThroughIntersection", true);
+ RepackedCompactedPortions = SubGroup->GetCounter(module + "/RepackedCompactedPortions", true);
+ MovedPortions = SubGroup->GetCounter(module + "/MovedPortions", true);
+ MovedPortionBytes = SubGroup->GetCounter(module + "/MovedPortionBytes", true);
+
+ TrashDataSerializationBytes = SubGroup->GetCounter(module + "/TrashDataSerializationBytes", true);
+ TrashDataSerialization = SubGroup->GetCounter(module + "/TrashDataSerialization", true);
+ CorrectDataSerializationBytes = SubGroup->GetCounter(module + "/CorrectDataSerializationBytes", true);
+ CorrectDataSerialization = SubGroup->GetCounter(module + "/CorrectDataSerialization", true);
+}
+
+}
diff --git a/ydb/core/tx/columnshard/counters/indexation.h b/ydb/core/tx/columnshard/counters/indexation.h
new file mode 100644
index 00000000000..a5db7ff395d
--- /dev/null
+++ b/ydb/core/tx/columnshard/counters/indexation.h
@@ -0,0 +1,29 @@
+#pragma once
+#include <library/cpp/monlib/dynamic_counters/counters.h>
+
+namespace NKikimr::NColumnShard {
+
+class TIndexationCounters {
+private:
+ ::NMonitoring::TDynamicCounterPtr SubGroup;
+public:
+ NMonitoring::TDynamicCounters::TCounterPtr ReadBytes;
+ NMonitoring::TDynamicCounters::TCounterPtr AnalizeCompactedPortions;
+ NMonitoring::TDynamicCounters::TCounterPtr AnalizeInsertedPortions;
+ NMonitoring::TDynamicCounters::TCounterPtr RepackedInsertedPortions;
+ NMonitoring::TDynamicCounters::TCounterPtr RepackedInsertedPortionBytes;
+ NMonitoring::TDynamicCounters::TCounterPtr SkipPortionsMoveThroughIntersection;
+ NMonitoring::TDynamicCounters::TCounterPtr SkipPortionBytesMoveThroughIntersection;
+ NMonitoring::TDynamicCounters::TCounterPtr RepackedCompactedPortions;
+ NMonitoring::TDynamicCounters::TCounterPtr MovedPortions;
+ NMonitoring::TDynamicCounters::TCounterPtr MovedPortionBytes;
+
+ NMonitoring::TDynamicCounters::TCounterPtr TrashDataSerializationBytes;
+ NMonitoring::TDynamicCounters::TCounterPtr TrashDataSerialization;
+ NMonitoring::TDynamicCounters::TCounterPtr CorrectDataSerializationBytes;
+ NMonitoring::TDynamicCounters::TCounterPtr CorrectDataSerialization;
+
+ TIndexationCounters(const TString& module);
+};
+
+}
diff --git a/ydb/core/tx/columnshard/counters/scan.cpp b/ydb/core/tx/columnshard/counters/scan.cpp
new file mode 100644
index 00000000000..4274e871bd1
--- /dev/null
+++ b/ydb/core/tx/columnshard/counters/scan.cpp
@@ -0,0 +1,34 @@
+#include "scan.h"
+#include <ydb/core/base/appdata.h>
+#include <ydb/core/base/counters.h>
+
+namespace NKikimr::NColumnShard {
+
+TScanCounters::TScanCounters(const TString& module) {
+ ::NMonitoring::TDynamicCounterPtr subGroup = GetServiceCounters(AppData()->Counters, "tablets")->GetSubgroup("subsystem", "columnshard");
+
+ PortionBytes = subGroup->GetCounter(module + "/PortionBytes", true);
+ FilterBytes = subGroup->GetCounter(module + "/FilterBytes", true);
+ PostFilterBytes = subGroup->GetCounter(module + "/PostFilterBytes", true);
+
+ AssembleFilterCount = subGroup->GetCounter(module + "/AssembleFilterCount", true);
+
+ FilterOnlyCount = subGroup->GetCounter(module + "/FilterOnlyCount", true);
+ FilterOnlyFetchedBytes = subGroup->GetCounter(module + "/FilterOnlyFetchedBytes", true);
+ FilterOnlyUsefulBytes = subGroup->GetCounter(module + "/FilterOnlyUsefulBytes", true);
+
+ EmptyFilterCount = subGroup->GetCounter(module + "/EmptyFilterCount", true);
+ EmptyFilterFetchedBytes = subGroup->GetCounter(module + "/EmptyFilterFetchedBytes", true);
+
+ OriginalRowsCount = subGroup->GetCounter(module + "/OriginalRowsCount", true);
+ FilteredRowsCount = subGroup->GetCounter(module + "/FilteredRowsCount", true);
+ SkippedBytes = subGroup->GetCounter(module + "/SkippedBytes", true);
+
+ TwoPhasesCount = subGroup->GetCounter(module + "/TwoPhasesCount", true);
+ TwoPhasesFilterFetchedBytes = subGroup->GetCounter(module + "/TwoPhasesFilterFetchedBytes", true);
+ TwoPhasesFilterUsefulBytes = subGroup->GetCounter(module + "/TwoPhasesFilterUsefulBytes", true);
+ TwoPhasesPostFilterFetchedBytes = subGroup->GetCounter(module + "/TwoPhasesPostFilterFetchedBytes", true);
+ TwoPhasesPostFilterUsefulBytes = subGroup->GetCounter(module + "/TwoPhasesPostFilterUsefulBytes", true);
+}
+
+}
diff --git a/ydb/core/tx/columnshard/counters/scan.h b/ydb/core/tx/columnshard/counters/scan.h
new file mode 100644
index 00000000000..1a204a21b93
--- /dev/null
+++ b/ydb/core/tx/columnshard/counters/scan.h
@@ -0,0 +1,33 @@
+#pragma once
+#include <library/cpp/monlib/dynamic_counters/counters.h>
+
+namespace NKikimr::NColumnShard {
+
+struct TScanCounters {
+ NMonitoring::TDynamicCounters::TCounterPtr PortionBytes;
+ NMonitoring::TDynamicCounters::TCounterPtr FilterBytes;
+ NMonitoring::TDynamicCounters::TCounterPtr PostFilterBytes;
+
+ NMonitoring::TDynamicCounters::TCounterPtr AssembleFilterCount;
+
+ NMonitoring::TDynamicCounters::TCounterPtr FilterOnlyCount;
+ NMonitoring::TDynamicCounters::TCounterPtr FilterOnlyFetchedBytes;
+ NMonitoring::TDynamicCounters::TCounterPtr FilterOnlyUsefulBytes;
+
+ NMonitoring::TDynamicCounters::TCounterPtr EmptyFilterCount;
+ NMonitoring::TDynamicCounters::TCounterPtr EmptyFilterFetchedBytes;
+
+ NMonitoring::TDynamicCounters::TCounterPtr OriginalRowsCount;
+ NMonitoring::TDynamicCounters::TCounterPtr FilteredRowsCount;
+ NMonitoring::TDynamicCounters::TCounterPtr SkippedBytes;
+
+ NMonitoring::TDynamicCounters::TCounterPtr TwoPhasesCount;
+ NMonitoring::TDynamicCounters::TCounterPtr TwoPhasesFilterFetchedBytes;
+ NMonitoring::TDynamicCounters::TCounterPtr TwoPhasesFilterUsefulBytes;
+ NMonitoring::TDynamicCounters::TCounterPtr TwoPhasesPostFilterFetchedBytes;
+ NMonitoring::TDynamicCounters::TCounterPtr TwoPhasesPostFilterUsefulBytes;
+
+ TScanCounters(const TString& module = "Scan");
+};
+
+}
diff --git a/ydb/core/tx/columnshard/engines/column_engine_logs.cpp b/ydb/core/tx/columnshard/engines/column_engine_logs.cpp
index 71bbf19b357..02099110aa9 100644
--- a/ydb/core/tx/columnshard/engines/column_engine_logs.cpp
+++ b/ydb/core/tx/columnshard/engines/column_engine_logs.cpp
@@ -486,7 +486,7 @@ std::shared_ptr<TColumnEngineChanges> TColumnEngineForLogs::StartCompaction(std:
if (changes->CompactionInfo->InGranule) {
const TSnapshot completedSnap = std::max(LastSnapshot, outdatedSnapshot);
if (!InitInGranuleMerge(changes->SrcGranule->Mark, changes->SwitchedPortions, limits, completedSnap, changes->MergeBorders)) {
- // Return granule to Compation list. This is equal to single compaction worker behaviour.
+ // Return granule to Compaction list. This is equal to single compaction worker behaviour.
CompactionGranules.insert(granule);
return {};
}
@@ -704,7 +704,7 @@ void TColumnEngineForLogs::UpdateOverloaded(const THashMap<ui64, std::shared_ptr
// Size exceeds the configured limit. Mark granule as overloaded.
if (size >= limits.GranuleOverloadSize) {
PathsGranulesOverloaded.emplace(pathId, granule);
- } else if (auto pi = PathsGranulesOverloaded.find(pathId); pi != PathsGranulesOverloaded.end()) {
+ } else if (auto pi = PathsGranulesOverloaded.find(pathId); pi != PathsGranulesOverloaded.end()) {
// Size is under limit. Remove granule from the overloaded set.
pi->second.erase(granule);
// Remove entry for the pathId if there it has no overloaded granules any more.
@@ -1316,7 +1316,7 @@ std::unique_ptr<TCompactionInfo> TColumnEngineForLogs::Compact(const TCompaction
bool inGranule = true;
for (auto it = CompactionGranules.upper_bound(lastCompactedGranule); !CompactionGranules.empty();) {
- // Start from the beggining if the end is reached.
+ // Start from the beginning if the end is reached.
if (it == CompactionGranules.end()) {
it = CompactionGranules.begin();
}
diff --git a/ydb/core/tx/columnshard/engines/index_logic_logs.cpp b/ydb/core/tx/columnshard/engines/index_logic_logs.cpp
index 684450d18c3..a3c42fd0783 100644
--- a/ydb/core/tx/columnshard/engines/index_logic_logs.cpp
+++ b/ydb/core/tx/columnshard/engines/index_logic_logs.cpp
@@ -113,7 +113,7 @@ std::vector<TPortionInfo> TIndexLogicBase::MakeAppendedPortions(const ui64 pathI
/// @warnign records are not valid cause of empty BlobId and zero Portion
TColumnRecord record = TColumnRecord::Make(granule, columnId, snapshot, 0);
auto columnSaver = resultSchema->GetColumnSaver(name, saverContext);
- auto blob = portionInfo.AddOneChunkColumn(portionBatch->GetColumnByName(name), field, std::move(record), columnSaver);
+ auto blob = portionInfo.AddOneChunkColumn(portionBatch->GetColumnByName(name), field, std::move(record), columnSaver, Counters);
if (!blob.size()) {
ok = false;
break;
@@ -212,7 +212,6 @@ std::vector<TString> TIndexationLogic::Apply(std::shared_ptr<TColumnEngineChange
Y_VERIFY(!changes->DataToIndex.empty());
Y_VERIFY(changes->AppendedPortions.empty());
-
auto maxSnapshot = TSnapshot::Zero();
for (auto& inserted : changes->DataToIndex) {
TSnapshot insertSnap = inserted.GetSnapshot();
@@ -533,7 +532,7 @@ ui64 TCompactionLogic::TryMovePortions(const TMark& ts0,
return std::make_tuple(std::span(partitioned.begin(), l), std::span(partitioned.begin() + l, partitioned.end()));
}();
- // Do nothing if there are less than two compacted protions.
+ // Do nothing if there are less than two compacted portions.
if (compacted.size() < 2) {
return 0;
}
@@ -541,9 +540,22 @@ ui64 TCompactionLogic::TryMovePortions(const TMark& ts0,
std::sort(compacted.begin(), compacted.end(), [](const TPortionInfo* a, const TPortionInfo* b) {
return a->IndexKeyStart() < b->IndexKeyStart();
});
+ Counters.AnalizeCompactedPortions->Add(compacted.size());
+ Counters.AnalizeInsertedPortions->Add(inserted.size());
+ for (auto&& i : inserted) {
+ Counters.RepackedInsertedPortionBytes->Add(i->BlobsBytes());
+ }
+ Counters.RepackedInsertedPortions->Add(inserted.size());
+
// Check that there are no gaps between two adjacent portions in term of primary key range.
for (size_t i = 0; i < compacted.size() - 1; ++i) {
if (compacted[i]->IndexKeyEnd() >= compacted[i + 1]->IndexKeyStart()) {
+ for (auto&& c : compacted) {
+ Counters.SkipPortionBytesMoveThroughIntersection->Add(c->BlobsBytes());
+ }
+
+ Counters.SkipPortionsMoveThroughIntersection->Add(compacted.size());
+ Counters.RepackedCompactedPortions->Add(compacted.size());
return 0;
}
}
@@ -555,12 +567,14 @@ ui64 TCompactionLogic::TryMovePortions(const TMark& ts0,
ui32 rows = portionInfo->NumRows();
Y_VERIFY(rows);
numRows += rows;
+ Counters.MovedPortionBytes->Add(portionInfo->BlobsBytes());
tsIds.emplace_back((counter ? TMark(portionInfo->IndexKeyStart()) : ts0), counter + 1);
toMove.emplace_back(std::move(*portionInfo), counter);
++counter;
// Ensure that std::move will take an effect.
static_assert(std::swappable<decltype(*portionInfo)>);
}
+ Counters.MovedPortions->Add(toMove.size());
std::vector<TPortionInfo> out;
out.reserve(inserted.size());
diff --git a/ydb/core/tx/columnshard/engines/index_logic_logs.h b/ydb/core/tx/columnshard/engines/index_logic_logs.h
index b13a84de6d0..46ef19696b6 100644
--- a/ydb/core/tx/columnshard/engines/index_logic_logs.h
+++ b/ydb/core/tx/columnshard/engines/index_logic_logs.h
@@ -3,24 +3,27 @@
#include "defs.h"
#include "portion_info.h"
#include "column_engine_logs.h"
+#include <ydb/core/tx/columnshard/counters.h>
namespace NKikimr::NOlap {
class TIndexLogicBase {
protected:
const TVersionedIndex& SchemaVersions;
+ const NColumnShard::TIndexationCounters Counters;
private:
const THashMap<ui64, NKikimr::NOlap::TTiering>* TieringMap = nullptr;
-
public:
- TIndexLogicBase(const TVersionedIndex& indexInfo, const THashMap<ui64, NKikimr::NOlap::TTiering>& tieringMap)
+ TIndexLogicBase(const TVersionedIndex& indexInfo, const THashMap<ui64, NKikimr::NOlap::TTiering>& tieringMap, const NColumnShard::TIndexationCounters& counters)
: SchemaVersions(indexInfo)
+ , Counters(counters)
, TieringMap(&tieringMap)
{
}
- TIndexLogicBase(const TVersionedIndex& indexInfo)
+ TIndexLogicBase(const TVersionedIndex& indexInfo, const NColumnShard::TIndexationCounters& counters)
: SchemaVersions(indexInfo)
+ , Counters(counters)
{
}
diff --git a/ydb/core/tx/columnshard/engines/portion_info.cpp b/ydb/core/tx/columnshard/engines/portion_info.cpp
index 74ab4f399a0..0de422f5db8 100644
--- a/ydb/core/tx/columnshard/engines/portion_info.cpp
+++ b/ydb/core/tx/columnshard/engines/portion_info.cpp
@@ -45,10 +45,16 @@ TString TPortionInfo::AddOneChunkColumn(const std::shared_ptr<arrow::Array>& arr
const std::shared_ptr<arrow::Field>& field,
TColumnRecord&& record,
const TColumnSaver saver,
+ const NColumnShard::TIndexationCounters& counters,
const ui32 limitBytes) {
auto blob = SerializeColumn(array, field, saver);
if (blob.size() >= limitBytes) {
+ counters.TrashDataSerializationBytes->Add(blob.size());
+ counters.TrashDataSerialization->Add(1);
return {};
+ } else {
+ counters.CorrectDataSerializationBytes->Add(blob.size());
+ counters.CorrectDataSerialization->Add(1);
}
record.Chunk = 0;
diff --git a/ydb/core/tx/columnshard/engines/portion_info.h b/ydb/core/tx/columnshard/engines/portion_info.h
index 4459d03b89a..149a1496c04 100644
--- a/ydb/core/tx/columnshard/engines/portion_info.h
+++ b/ydb/core/tx/columnshard/engines/portion_info.h
@@ -7,6 +7,7 @@
#include <ydb/core/formats/arrow/replace_key.h>
#include <ydb/core/formats/arrow/serializer/abstract.h>
#include <ydb/core/formats/arrow/dictionary/conversion.h>
+#include <ydb/core/tx/columnshard/counters/indexation.h>
namespace NKikimr::NOlap {
@@ -587,6 +588,7 @@ public:
const std::shared_ptr<arrow::Field>& field,
TColumnRecord&& record,
const TColumnSaver saver,
+ const NColumnShard::TIndexationCounters& counters,
ui32 limitBytes = BLOB_BYTES_LIMIT);
friend IOutputStream& operator << (IOutputStream& out, const TPortionInfo& info) {
diff --git a/ydb/core/tx/columnshard/engines/ut/CMakeLists.darwin-x86_64.txt b/ydb/core/tx/columnshard/engines/ut/CMakeLists.darwin-x86_64.txt
index bb5302afd2e..33224314acf 100644
--- a/ydb/core/tx/columnshard/engines/ut/CMakeLists.darwin-x86_64.txt
+++ b/ydb/core/tx/columnshard/engines/ut/CMakeLists.darwin-x86_64.txt
@@ -24,6 +24,7 @@ target_link_libraries(ydb-core-tx-columnshard-engines-ut PUBLIC
ydb-core-base
ydb-core-tablet
ydb-core-tablet_flat
+ tx-columnshard-counters
yql-sql-pg_dummy
)
target_link_options(ydb-core-tx-columnshard-engines-ut PRIVATE
diff --git a/ydb/core/tx/columnshard/engines/ut/CMakeLists.linux-aarch64.txt b/ydb/core/tx/columnshard/engines/ut/CMakeLists.linux-aarch64.txt
index 670981735be..571d214b767 100644
--- a/ydb/core/tx/columnshard/engines/ut/CMakeLists.linux-aarch64.txt
+++ b/ydb/core/tx/columnshard/engines/ut/CMakeLists.linux-aarch64.txt
@@ -24,6 +24,7 @@ target_link_libraries(ydb-core-tx-columnshard-engines-ut PUBLIC
ydb-core-base
ydb-core-tablet
ydb-core-tablet_flat
+ tx-columnshard-counters
yql-sql-pg_dummy
)
target_link_options(ydb-core-tx-columnshard-engines-ut PRIVATE
diff --git a/ydb/core/tx/columnshard/engines/ut/CMakeLists.linux-x86_64.txt b/ydb/core/tx/columnshard/engines/ut/CMakeLists.linux-x86_64.txt
index 1c18142fc5d..54cd8327409 100644
--- a/ydb/core/tx/columnshard/engines/ut/CMakeLists.linux-x86_64.txt
+++ b/ydb/core/tx/columnshard/engines/ut/CMakeLists.linux-x86_64.txt
@@ -25,6 +25,7 @@ target_link_libraries(ydb-core-tx-columnshard-engines-ut PUBLIC
ydb-core-base
ydb-core-tablet
ydb-core-tablet_flat
+ tx-columnshard-counters
yql-sql-pg_dummy
)
target_link_options(ydb-core-tx-columnshard-engines-ut PRIVATE
diff --git a/ydb/core/tx/columnshard/engines/ut/CMakeLists.windows-x86_64.txt b/ydb/core/tx/columnshard/engines/ut/CMakeLists.windows-x86_64.txt
index 042e86eb845..091ad519d80 100644
--- a/ydb/core/tx/columnshard/engines/ut/CMakeLists.windows-x86_64.txt
+++ b/ydb/core/tx/columnshard/engines/ut/CMakeLists.windows-x86_64.txt
@@ -24,6 +24,7 @@ target_link_libraries(ydb-core-tx-columnshard-engines-ut PUBLIC
ydb-core-base
ydb-core-tablet
ydb-core-tablet_flat
+ tx-columnshard-counters
yql-sql-pg_dummy
)
target_sources(ydb-core-tx-columnshard-engines-ut PRIVATE
diff --git a/ydb/core/tx/columnshard/engines/ut_logs_engine.cpp b/ydb/core/tx/columnshard/engines/ut_logs_engine.cpp
index e85dd848ec7..35e1347a0ff 100644
--- a/ydb/core/tx/columnshard/engines/ut_logs_engine.cpp
+++ b/ydb/core/tx/columnshard/engines/ut_logs_engine.cpp
@@ -280,7 +280,7 @@ bool Insert(TColumnEngineForLogs& engine, TTestDbWrapper& db, TSnapshot snap,
changes->Blobs.insert(blobs.begin(), blobs.end());
- TIndexationLogic logic(engine.GetVersionedIndex());
+ TIndexationLogic logic(engine.GetVersionedIndex(), NColumnShard::TIndexationCounters("Indexation"));
std::vector<TString> newBlobs = logic.Apply(changes);
UNIT_ASSERT_VALUES_EQUAL(changes->AppendedPortions.size(), 1);
UNIT_ASSERT_VALUES_EQUAL(newBlobs.size(), testColumns.size() + 2); // add 2 columns: planStep, txId
@@ -306,7 +306,7 @@ bool Compact(TColumnEngineForLogs& engine, TTestDbWrapper& db, TSnapshot snap, T
UNIT_ASSERT_VALUES_EQUAL(changes->SwitchedPortions.size(), expected.SrcPortions);
changes->SetBlobs(std::move(blobs));
- TCompactionLogic logic(engine.GetVersionedIndex());
+ TCompactionLogic logic(engine.GetVersionedIndex(), NColumnShard::TIndexationCounters("Compaction"));
std::vector<TString> newBlobs = logic.Apply(changes);
UNIT_ASSERT_VALUES_EQUAL(changes->AppendedPortions.size(), expected.NewPortions);
AddIdsToBlobs(newBlobs, changes->AppendedPortions, changes->Blobs, step);
diff --git a/ydb/core/tx/columnshard/eviction_actor.cpp b/ydb/core/tx/columnshard/eviction_actor.cpp
index b9ea3e2d8d5..806eda142a6 100644
--- a/ydb/core/tx/columnshard/eviction_actor.cpp
+++ b/ydb/core/tx/columnshard/eviction_actor.cpp
@@ -9,13 +9,16 @@ namespace {
using NOlap::TBlobRange;
class TEvictionActor : public TActorBootstrapped<TEvictionActor> {
+private:
+ const TIndexationCounters Counters;
public:
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
return NKikimrServices::TActivity::TX_COLUMNSHARD_EVICTION_ACTOR;
}
- TEvictionActor(ui64 tabletId, const TActorId& parent)
- : TabletId(tabletId)
+ TEvictionActor(ui64 tabletId, const TActorId& parent, const TIndexationCounters& counters)
+ : Counters(counters)
+ , TabletId(tabletId)
, Parent(parent)
, BlobCacheActorId(NBlobCache::MakeBlobCacheServiceId())
{}
@@ -36,6 +39,7 @@ public:
for (const auto& blobRange : ranges) {
Y_VERIFY(blobId == blobRange.BlobId);
+ Counters.ReadBytes->Add(blobRange.Size);
Blobs[blobRange] = {};
}
SendReadRequest(std::move(ranges), event.Externals.contains(blobId));
@@ -128,7 +132,7 @@ private:
TCpuGuard guard(TxEvent->ResourceUsage);
TxEvent->IndexChanges->SetBlobs(std::move(Blobs));
- NOlap::TEvictionLogic evictionLogic(TxEvent->IndexInfo, TxEvent->Tiering);
+ NOlap::TEvictionLogic evictionLogic(TxEvent->IndexInfo, TxEvent->Tiering, Counters);
TxEvent->Blobs = evictionLogic.Apply(TxEvent->IndexChanges);
if (TxEvent->Blobs.empty()) {
@@ -145,8 +149,8 @@ private:
} // namespace
-IActor* CreateEvictionActor(ui64 tabletId, const TActorId& parent) {
- return new TEvictionActor(tabletId, parent);
+IActor* CreateEvictionActor(ui64 tabletId, const TActorId& parent, const TIndexationCounters& counters) {
+ return new TEvictionActor(tabletId, parent, counters);
}
}
diff --git a/ydb/core/tx/columnshard/indexing_actor.cpp b/ydb/core/tx/columnshard/indexing_actor.cpp
index 8ebd6c558aa..d7d5bac9d25 100644
--- a/ydb/core/tx/columnshard/indexing_actor.cpp
+++ b/ydb/core/tx/columnshard/indexing_actor.cpp
@@ -7,13 +7,16 @@ namespace NKikimr::NColumnShard {
namespace {
class TIndexingActor : public TActorBootstrapped<TIndexingActor> {
+private:
+ const TIndexationCounters Counters;
public:
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
return NKikimrServices::TActivity::TX_COLUMNSHARD_INDEXING_ACTOR;
}
- TIndexingActor(ui64 tabletId, const TActorId& parent)
- : TabletId(tabletId)
+ TIndexingActor(ui64 tabletId, const TActorId& parent, const TIndexationCounters& counters)
+ : Counters(counters)
+ , TabletId(tabletId)
, Parent(parent)
, BlobCacheActorId(NBlobCache::MakeBlobCacheServiceId())
{}
@@ -39,6 +42,7 @@ public:
auto res = BlobsToRead.emplace(blobId, i);
Y_VERIFY(res.second, "Duplicate blob in DataToIndex: %s", blobId.ToStringNew().c_str());
SendReadRequest(NBlobCache::TBlobRange(blobId, 0, blobId.BlobSize()));
+ Counters.ReadBytes->Add(blobId.BlobSize());
}
if (BlobsToRead.empty()) {
@@ -125,7 +129,7 @@ private:
LOG_S_DEBUG("Indexing started at tablet " << TabletId);
TCpuGuard guard(TxEvent->ResourceUsage);
- NOlap::TIndexationLogic indexationLogic(TxEvent->IndexInfo, TxEvent->Tiering);
+ NOlap::TIndexationLogic indexationLogic(TxEvent->IndexInfo, TxEvent->Tiering, Counters);
TxEvent->Blobs = indexationLogic.Apply(TxEvent->IndexChanges);
LOG_S_DEBUG("Indexing finished at tablet " << TabletId);
} else {
@@ -140,8 +144,8 @@ private:
} // namespace
-IActor* CreateIndexingActor(ui64 tabletId, const TActorId& parent) {
- return new TIndexingActor(tabletId, parent);
+IActor* CreateIndexingActor(ui64 tabletId, const TActorId& parent, const TIndexationCounters& counters) {
+ return new TIndexingActor(tabletId, parent, counters);
}
}