diff options
| author | ivanmorozov <[email protected]> | 2023-08-11 16:58:33 +0300 |
|---|---|---|
| committer | ivanmorozov <[email protected]> | 2023-08-11 18:25:55 +0300 |
| commit | f7f0a9ecb680b67875947320653f4b6dad2a7c47 (patch) | |
| tree | 4d716fdce0e8196fa6ea993105005e45f2a85a4f | |
| parent | e54d370f82947014c450750f266e5696241decc0 (diff) | |
KIKIMR-18932: additional helpers for print debug info
6 files changed, 35 insertions, 0 deletions
diff --git a/ydb/core/tx/columnshard/engines/scheme/abstract_scheme.h b/ydb/core/tx/columnshard/engines/scheme/abstract_scheme.h index 02748f05c90..2ca1d4a0f28 100644 --- a/ydb/core/tx/columnshard/engines/scheme/abstract_scheme.h +++ b/ydb/core/tx/columnshard/engines/scheme/abstract_scheme.h @@ -12,6 +12,8 @@ namespace NKikimr::NOlap { struct TIndexInfo; class ISnapshotSchema { +protected: + virtual TString DoDebugString() const = 0; public: using TPtr = std::shared_ptr<ISnapshotSchema>; @@ -37,6 +39,9 @@ public: std::shared_ptr<arrow::Field> GetFieldByIndex(const int index) const; std::shared_ptr<arrow::Field> GetFieldByColumnId(const ui32 columnId) const; + TString DebugString() const { + return DoDebugString(); + } virtual const std::shared_ptr<arrow::Schema>& GetSchema() const = 0; virtual const TIndexInfo& GetIndexInfo() const = 0; virtual const TSnapshot& GetSnapshot() const = 0; diff --git a/ydb/core/tx/columnshard/engines/scheme/filtered_scheme.cpp b/ydb/core/tx/columnshard/engines/scheme/filtered_scheme.cpp index 61d3a8d200e..b6bbd968eac 100644 --- a/ydb/core/tx/columnshard/engines/scheme/filtered_scheme.cpp +++ b/ydb/core/tx/columnshard/engines/scheme/filtered_scheme.cpp @@ -1,4 +1,5 @@ #include "filtered_scheme.h" +#include <util/string/join.h> namespace NKikimr::NOlap { @@ -67,4 +68,12 @@ ui64 TFilteredSnapshotSchema::GetVersion() const { return OriginalSnapshot->GetIndexInfo().GetVersion(); } +TString TFilteredSnapshotSchema::DoDebugString() const { + return TStringBuilder() << "(" + << "original=" << OriginalSnapshot->DebugString() << ";" + << "column_ids=[" << JoinSeq(",", ColumnIds) << "];" + << ")" + ; +} + } diff --git a/ydb/core/tx/columnshard/engines/scheme/filtered_scheme.h b/ydb/core/tx/columnshard/engines/scheme/filtered_scheme.h index 9673d780611..ada26920857 100644 --- a/ydb/core/tx/columnshard/engines/scheme/filtered_scheme.h +++ b/ydb/core/tx/columnshard/engines/scheme/filtered_scheme.h @@ -10,6 +10,8 @@ class TFilteredSnapshotSchema: public ISnapshotSchema { ISnapshotSchema::TPtr OriginalSnapshot; std::shared_ptr<arrow::Schema> Schema; std::set<ui32> ColumnIds; +protected: + virtual TString DoDebugString() const override; public: TFilteredSnapshotSchema(ISnapshotSchema::TPtr originalSnapshot, const std::vector<ui32>& columnIds); TFilteredSnapshotSchema(ISnapshotSchema::TPtr originalSnapshot, const std::set<ui32>& columnIds); diff --git a/ydb/core/tx/columnshard/engines/scheme/index_info.h b/ydb/core/tx/columnshard/engines/scheme/index_info.h index ec8835e71ff..b2fe0a1a719 100644 --- a/ydb/core/tx/columnshard/engines/scheme/index_info.h +++ b/ydb/core/tx/columnshard/engines/scheme/index_info.h @@ -49,6 +49,14 @@ public: TX_ID, }; + TString DebugString() const { + return TStringBuilder() << "(" + << "id=" << Id << ";" + << "version=" << Version << ";" + << "name=" << Name << ";" + << ")"; + } + /// Appends the special columns to the batch. static std::shared_ptr<arrow::RecordBatch> AddSpecialColumns( const std::shared_ptr<arrow::RecordBatch>& batch, diff --git a/ydb/core/tx/columnshard/engines/scheme/snapshot_scheme.h b/ydb/core/tx/columnshard/engines/scheme/snapshot_scheme.h index e144e7fe35a..1ca00da553a 100644 --- a/ydb/core/tx/columnshard/engines/scheme/snapshot_scheme.h +++ b/ydb/core/tx/columnshard/engines/scheme/snapshot_scheme.h @@ -11,6 +11,15 @@ private: TIndexInfo IndexInfo; std::shared_ptr<arrow::Schema> Schema; TSnapshot Snapshot; +protected: + virtual TString DoDebugString() const override { + return TStringBuilder() << "(" + "schema=" << Schema->ToString() << ";" << + "snapshot=" << Snapshot.DebugString() << ";" << + "index_info=" << IndexInfo.DebugString() << ";" << + ")" + ; + } public: TSnapshotSchema(TIndexInfo&& indexInfo, const TSnapshot& snapshot); diff --git a/ydb/core/tx/columnshard/engines/storage/storage.cpp b/ydb/core/tx/columnshard/engines/storage/storage.cpp index 98c54750715..ef370455743 100644 --- a/ydb/core/tx/columnshard/engines/storage/storage.cpp +++ b/ydb/core/tx/columnshard/engines/storage/storage.cpp @@ -18,9 +18,11 @@ void TGranulesStorage::UpdateGranuleInfo(const TGranuleMeta& granule) { auto it = GranulesCompactionPriority.find(granule.GetGranuleId()); auto gPriority = granule.GetCompactionPriority(); if (it == GranulesCompactionPriority.end()) { + AFL_TRACE(NKikimrServices::TX_COLUMNSHARD)("event", "UpdateGranuleInfo")("granule", granule.DebugString())("new_priority", gPriority.DebugString()); it = GranulesCompactionPriority.emplace(granule.GetGranuleId(), gPriority).first; Y_VERIFY(GranuleCompactionPrioritySorting[gPriority].emplace(granule.GetGranuleId()).second); } else { + AFL_TRACE(NKikimrServices::TX_COLUMNSHARD)("event", "UpdateGranuleInfo")("granule", granule.DebugString())("new_priority", gPriority.DebugString())("old_priority", it->second.DebugString()); auto itSorting = GranuleCompactionPrioritySorting.find(it->second); Y_VERIFY(itSorting != GranuleCompactionPrioritySorting.end()); Y_VERIFY(itSorting->second.erase(granule.GetGranuleId())); |
