From 93e92dab3bec1d82d3e88fee08a9eee0a3e3b6c9 Mon Sep 17 00:00:00 2001 From: attack204 Date: Fri, 10 Feb 2023 16:05:50 +0800 Subject: [PATCH] rename API --- src/Interpreters/ServerAsynchronousMetrics.cpp | 2 +- src/Storages/MergeTree/MergeTreeData.cpp | 12 +++++++----- src/Storages/MergeTree/MergeTreeData.h | 6 +++--- src/Storages/System/StorageSystemTables.cpp | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/Interpreters/ServerAsynchronousMetrics.cpp b/src/Interpreters/ServerAsynchronousMetrics.cpp index 0777ffd6c44..dc24fa45573 100644 --- a/src/Interpreters/ServerAsynchronousMetrics.cpp +++ b/src/Interpreters/ServerAsynchronousMetrics.cpp @@ -245,7 +245,7 @@ void ServerAsynchronousMetrics::updateImpl(AsynchronousMetricValues & new_values calculateMax(max_part_count_for_partition, table_merge_tree->getMaxPartsCountAndSizeForPartition().first); total_number_of_bytes += table_merge_tree->totalBytes(settings).value(); total_number_of_rows += table_merge_tree->totalRows(settings).value(); - total_number_of_parts += table_merge_tree->getPartsCount(); + total_number_of_parts += table_merge_tree->getActivePartsCount(); } if (StorageReplicatedMergeTree * table_replicated_merge_tree = typeid_cast(table.get())) diff --git a/src/Storages/MergeTree/MergeTreeData.cpp b/src/Storages/MergeTree/MergeTreeData.cpp index 9052e5e799e..2f1fda1d727 100644 --- a/src/Storages/MergeTree/MergeTreeData.cpp +++ b/src/Storages/MergeTree/MergeTreeData.cpp @@ -3991,7 +3991,7 @@ size_t MergeTreeData::getTotalActiveSizeInRows() const } -size_t MergeTreeData::getPartsCount() const +size_t MergeTreeData::getActivePartsCount() const { return total_active_size_parts.load(std::memory_order_acquire); } @@ -4062,7 +4062,7 @@ void MergeTreeData::delayInsertOrThrowIfNeeded(Poco::Event * until, const Contex { const auto settings = getSettings(); const auto & query_settings = query_context->getSettingsRef(); - const size_t parts_count_in_total = getPartsCount(); + const size_t parts_count_in_total = getActivePartsCount(); /// check if have too many parts in total if (parts_count_in_total >= settings->max_parts_in_total) @@ -5305,13 +5305,15 @@ MergeTreeData::DataPartsVector MergeTreeData::getAllDataPartsVector(MergeTreeDat return res; } -size_t MergeTreeData::getDataPartsSize() const { +size_t MergeTreeData::getAllDataPartsSize() const +{ return data_parts_by_info.size(); } -size_t MergeTreeData::getTotalMarksCount() const { +size_t MergeTreeData::getTotalMarksCount() const +{ size_t total_marks = 0; - for (auto & part : getAllDataPartsVector()) + for (auto & part : data_parts_by_info) { total_marks += part->getMarksCount(); } diff --git a/src/Storages/MergeTree/MergeTreeData.h b/src/Storages/MergeTree/MergeTreeData.h index f09b8fe4386..76a0e7063d0 100644 --- a/src/Storages/MergeTree/MergeTreeData.h +++ b/src/Storages/MergeTree/MergeTreeData.h @@ -474,9 +474,9 @@ public: /// Returns absolutely all parts (and snapshot of their states) DataPartsVector getAllDataPartsVector(DataPartStateVector * out_states = nullptr) const; - + /// Return parts number - size_t getDataPartsSize() const; + size_t getAllDataPartsSize() const; /// Return the number of marks in all parts size_t getTotalMarksCount() const; @@ -525,7 +525,7 @@ public: size_t getTotalActiveSizeInRows() const; - size_t getPartsCount() const; + size_t getActivePartsCount() const; /// Returns a pair with: max number of parts in partition across partitions; sum size of parts inside that partition. /// (if there are multiple partitions with max number of parts, the sum size of parts is returned for arbitrary of them) diff --git a/src/Storages/System/StorageSystemTables.cpp b/src/Storages/System/StorageSystemTables.cpp index 9eecef2a7e1..a4e86d885a8 100644 --- a/src/Storages/System/StorageSystemTables.cpp +++ b/src/Storages/System/StorageSystemTables.cpp @@ -463,7 +463,7 @@ protected: if (columns_mask[src_index++]) { if (table_merge_tree) - res_columns[res_index++]->insert(table_merge_tree->getDataPartsSize()); + res_columns[res_index++]->insert(table_merge_tree->getAllDataPartsSize()); else res_columns[res_index++]->insertDefault(); } @@ -471,7 +471,7 @@ protected: if (columns_mask[src_index++]) { if (table_merge_tree) - res_columns[res_index++]->insert(table_merge_tree->getPartsCount()); + res_columns[res_index++]->insert(table_merge_tree->getActivePartsCount()); else res_columns[res_index++]->insertDefault(); }