aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornsofya <nsofya@ydb.tech>2023-12-13 22:52:58 +0300
committernsofya <nsofya@ydb.tech>2023-12-14 00:11:16 +0300
commit91ecc69b22a78d3e823a1f6c9475c149e3dfaa36 (patch)
tree43dafde93f048f35318e61b32c633eda174c397b
parent6b46f8f4fcb83d37f172624665855c96d2c1b730 (diff)
downloadydb-91ecc69b22a78d3e823a1f6c9475c149e3dfaa36.tar.gz
PR from branch users/nsofya/KIKIMR-19564
Report schema versions Base for tablet viewer
-rw-r--r--ydb/core/tx/columnshard/CMakeLists.darwin-arm64.txt1
-rw-r--r--ydb/core/tx/columnshard/CMakeLists.darwin-x86_64.txt1
-rw-r--r--ydb/core/tx/columnshard/CMakeLists.linux-aarch64.txt1
-rw-r--r--ydb/core/tx/columnshard/CMakeLists.linux-x86_64.txt1
-rw-r--r--ydb/core/tx/columnshard/CMakeLists.windows-x86_64.txt1
-rw-r--r--ydb/core/tx/columnshard/columnshard_impl.h3
-rw-r--r--ydb/core/tx/columnshard/columnshard_view.cpp44
-rw-r--r--ydb/core/tx/columnshard/columnshard_view.h6
-rw-r--r--ydb/core/tx/columnshard/tables_manager.cpp25
-rw-r--r--ydb/core/tx/columnshard/tables_manager.h1
-rw-r--r--ydb/core/tx/columnshard/ya.make1
11 files changed, 84 insertions, 1 deletions
diff --git a/ydb/core/tx/columnshard/CMakeLists.darwin-arm64.txt b/ydb/core/tx/columnshard/CMakeLists.darwin-arm64.txt
index d0a994c010..b2e4f43959 100644
--- a/ydb/core/tx/columnshard/CMakeLists.darwin-arm64.txt
+++ b/ydb/core/tx/columnshard/CMakeLists.darwin-arm64.txt
@@ -92,6 +92,7 @@ target_sources(core-tx-columnshard PRIVATE
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_common.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_private_events.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_schema.cpp
+ ${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_view.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/counters.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/defs.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/read_actor.cpp
diff --git a/ydb/core/tx/columnshard/CMakeLists.darwin-x86_64.txt b/ydb/core/tx/columnshard/CMakeLists.darwin-x86_64.txt
index d0a994c010..b2e4f43959 100644
--- a/ydb/core/tx/columnshard/CMakeLists.darwin-x86_64.txt
+++ b/ydb/core/tx/columnshard/CMakeLists.darwin-x86_64.txt
@@ -92,6 +92,7 @@ target_sources(core-tx-columnshard PRIVATE
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_common.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_private_events.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_schema.cpp
+ ${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_view.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/counters.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/defs.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/read_actor.cpp
diff --git a/ydb/core/tx/columnshard/CMakeLists.linux-aarch64.txt b/ydb/core/tx/columnshard/CMakeLists.linux-aarch64.txt
index 1b48684b2f..b80449d91d 100644
--- a/ydb/core/tx/columnshard/CMakeLists.linux-aarch64.txt
+++ b/ydb/core/tx/columnshard/CMakeLists.linux-aarch64.txt
@@ -93,6 +93,7 @@ target_sources(core-tx-columnshard PRIVATE
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_common.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_private_events.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_schema.cpp
+ ${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_view.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/counters.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/defs.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/read_actor.cpp
diff --git a/ydb/core/tx/columnshard/CMakeLists.linux-x86_64.txt b/ydb/core/tx/columnshard/CMakeLists.linux-x86_64.txt
index 1b48684b2f..b80449d91d 100644
--- a/ydb/core/tx/columnshard/CMakeLists.linux-x86_64.txt
+++ b/ydb/core/tx/columnshard/CMakeLists.linux-x86_64.txt
@@ -93,6 +93,7 @@ target_sources(core-tx-columnshard PRIVATE
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_common.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_private_events.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_schema.cpp
+ ${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_view.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/counters.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/defs.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/read_actor.cpp
diff --git a/ydb/core/tx/columnshard/CMakeLists.windows-x86_64.txt b/ydb/core/tx/columnshard/CMakeLists.windows-x86_64.txt
index 51ed6dadfa..22054ed5de 100644
--- a/ydb/core/tx/columnshard/CMakeLists.windows-x86_64.txt
+++ b/ydb/core/tx/columnshard/CMakeLists.windows-x86_64.txt
@@ -93,6 +93,7 @@ target_sources(core-tx-columnshard PRIVATE
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_common.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_private_events.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_schema.cpp
+ ${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/columnshard_view.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/counters.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/defs.cpp
${CMAKE_SOURCE_DIR}/ydb/core/tx/columnshard/read_actor.cpp
diff --git a/ydb/core/tx/columnshard/columnshard_impl.h b/ydb/core/tx/columnshard/columnshard_impl.h
index 779a37ed01..73990e2e31 100644
--- a/ydb/core/tx/columnshard/columnshard_impl.h
+++ b/ydb/core/tx/columnshard/columnshard_impl.h
@@ -117,6 +117,7 @@ class TColumnShard
friend class TTxProcessGCResult;
friend class TTxReadBlobRanges;
friend class TTxApplyNormalizer;
+ friend class TTxMonitoring;
friend class NOlap::TCleanupColumnEngineChanges;
friend class NOlap::TTTLColumnEngineChanges;
@@ -170,7 +171,7 @@ class TColumnShard
void OnDetach(const TActorContext& ctx) override;
//void OnTabletStop(TEvTablet::TEvTabletStop::TPtr& ev, const TActorContext& ctx);
void OnTabletDead(TEvTablet::TEvTabletDead::TPtr& ev, const TActorContext& ctx) override;
- //bool OnRenderAppHtmlPage(NMon::TEvRemoteHttpInfo::TPtr ev, const TActorContext& ctx);
+ bool OnRenderAppHtmlPage(NMon::TEvRemoteHttpInfo::TPtr ev, const TActorContext& ctx) override;
void DefaultSignalTabletActive(const TActorContext& ctx) override {
Y_UNUSED(ctx);
diff --git a/ydb/core/tx/columnshard/columnshard_view.cpp b/ydb/core/tx/columnshard/columnshard_view.cpp
new file mode 100644
index 0000000000..5783de53fe
--- /dev/null
+++ b/ydb/core/tx/columnshard/columnshard_view.cpp
@@ -0,0 +1,44 @@
+#include "columnshard_impl.h"
+#include "columnshard_view.h"
+
+namespace NKikimr::NColumnShard {
+
+class TTxMonitoring : public TTransactionBase<TColumnShard> {
+public:
+ TTxMonitoring(TColumnShard* self, const NMon::TEvRemoteHttpInfo::TPtr& ev)
+ : TBase(self)
+ , HttpInfoEvent(ev)
+ {}
+
+ bool Execute(TTransactionContext& txc, const TActorContext& ctx) override;
+ void Complete(const TActorContext& ctx) override;
+ //TTxType GetTxType() const override { return TXTYPE_INIT; }
+
+private:
+ NMon::TEvRemoteHttpInfo::TPtr HttpInfoEvent;
+ NJson::TJsonValue JsonReport = NJson::JSON_MAP;
+};
+
+
+bool TTxMonitoring::Execute(TTransactionContext& txc, const TActorContext&) {
+ return Self->TablesManager.FillMonitoringReport(txc, JsonReport["tables_manager"]);
+}
+
+void TTxMonitoring::Complete(const TActorContext& ctx) {
+ ctx.Send(HttpInfoEvent->Sender, new NMon::TEvRemoteJsonInfoRes(JsonReport.GetStringRobust()));
+}
+
+bool TColumnShard::OnRenderAppHtmlPage(NMon::TEvRemoteHttpInfo::TPtr ev, const TActorContext& ctx) {
+ if (!Executor() || !Executor()->GetStats().IsActive) {
+ return false;
+ }
+
+ if (!ev) {
+ return true;
+ }
+
+ Execute(new TTxMonitoring(this, ev), ctx);
+ return true;
+}
+
+}
diff --git a/ydb/core/tx/columnshard/columnshard_view.h b/ydb/core/tx/columnshard/columnshard_view.h
new file mode 100644
index 0000000000..73273a21f6
--- /dev/null
+++ b/ydb/core/tx/columnshard/columnshard_view.h
@@ -0,0 +1,6 @@
+#pragma once
+
+namespace NKikimr::NColumnShard {
+
+
+}
diff --git a/ydb/core/tx/columnshard/tables_manager.cpp b/ydb/core/tx/columnshard/tables_manager.cpp
index cab9f5758c..303e223032 100644
--- a/ydb/core/tx/columnshard/tables_manager.cpp
+++ b/ydb/core/tx/columnshard/tables_manager.cpp
@@ -6,6 +6,9 @@
#include <ydb/core/tx/tiering/manager.h>
#include <ydb/core/tablet_flat/tablet_flat_executor.h>
+#include <library/cpp/protobuf/json/proto2json.h>
+#include <ydb/core/tablet_flat/tablet_flat_executor.h>
+
namespace NKikimr::NColumnShard {
@@ -14,6 +17,28 @@ void TSchemaPreset::Deserialize(const NKikimrSchemeOp::TColumnTableSchemaPreset&
Name = presetProto.GetName();
}
+bool TTablesManager::FillMonitoringReport(NTabletFlatExecutor::TTransactionContext& txc, NJson::TJsonValue& json) {
+ NIceDb::TNiceDb db(txc.DB);
+ {
+ auto& schemaJson = json.InsertValue("schema_versions", NJson::JSON_ARRAY);
+ auto rowset = db.Table<Schema::SchemaPresetVersionInfo>().Select();
+ if (!rowset.IsReady()) {
+ return false;
+ }
+
+ while (!rowset.EndOfSet()) {
+ TSchemaPreset::TSchemaPresetVersionInfo info;
+ Y_ABORT_UNLESS(info.ParseFromString(rowset.GetValue<Schema::SchemaPresetVersionInfo::InfoProto>()));
+ NProtobufJson::Proto2Json(info, schemaJson.AppendValue(NJson::JSON_MAP));
+
+ if (!rowset.Next()) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
bool TTablesManager::InitFromDB(NIceDb::TNiceDb& db) {
{
auto rowset = db.Table<Schema::TableInfo>().Select();
diff --git a/ydb/core/tx/columnshard/tables_manager.h b/ydb/core/tx/columnshard/tables_manager.h
index 4642389721..33e6806a13 100644
--- a/ydb/core/tx/columnshard/tables_manager.h
+++ b/ydb/core/tx/columnshard/tables_manager.h
@@ -210,6 +210,7 @@ public:
void AddSchemaVersion(const ui32 presetId, const TRowVersion& version, const NKikimrSchemeOp::TColumnTableSchema& schema, NIceDb::TNiceDb& db);
void AddTableVersion(const ui64 pathId, const TRowVersion& version, const TTableInfo::TTableVersionInfo& versionInfo, NIceDb::TNiceDb& db);
+ bool FillMonitoringReport(NTabletFlatExecutor::TTransactionContext& txc, NJson::TJsonValue& json);
private:
void IndexSchemaVersion(const TRowVersion& version, const NKikimrSchemeOp::TColumnTableSchema& schema);
static NOlap::TIndexInfo DeserializeIndexInfoFromProto(const NKikimrSchemeOp::TColumnTableSchema& schema);
diff --git a/ydb/core/tx/columnshard/ya.make b/ydb/core/tx/columnshard/ya.make
index 6c40ee82ff..22177da5be 100644
--- a/ydb/core/tx/columnshard/ya.make
+++ b/ydb/core/tx/columnshard/ya.make
@@ -23,6 +23,7 @@ SRCS(
columnshard_common.cpp
columnshard_private_events.cpp
columnshard_schema.cpp
+ columnshard_view.cpp
counters.cpp
defs.cpp
read_actor.cpp