From 0cf896f5a0d5243105e0ff0d952de32ebf2a623c Mon Sep 17 00:00:00 2001 From: Julia Kartseva Date: Wed, 6 Nov 2024 02:05:19 +0000 Subject: [PATCH] fix parallel replicas display in interactive metrics --- src/Client/ProgressTable.cpp | 16 +++------------- src/Client/ProgressTable.h | 2 -- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/Client/ProgressTable.cpp b/src/Client/ProgressTable.cpp index f63935440e4..0504da9f283 100644 --- a/src/Client/ProgressTable.cpp +++ b/src/Client/ProgressTable.cpp @@ -197,8 +197,7 @@ void ProgressTable::writeTable(WriteBufferFromFileDescriptor & message, bool sho std::lock_guard lock{mutex}; if (!show_table && toggle_enabled) { - if (written_first_block) - message << CLEAR_TO_END_OF_SCREEN; + message << CLEAR_TO_END_OF_SCREEN; message << HIDE_CURSOR; message << "\n"; @@ -341,12 +340,7 @@ void ProgressTable::updateTable(const Block & block) continue; auto it = metrics.find(name); - - /// If the table has already been written, then do not add new metrics to avoid jitter. - if (it == metrics.end() && written_first_block) - continue; - - if (!written_first_block) + if (it == metrics.end()) it = metrics.try_emplace(name).first; it->second.updateHostValue(host_name, type, value, time_now); @@ -354,10 +348,7 @@ void ProgressTable::updateTable(const Block & block) max_event_name_width = std::max(max_event_name_width, name.size()); } - if (!written_first_block) - column_event_name_width = max_event_name_width + 1; - - written_first_block = true; + column_event_name_width = max_event_name_width + 1; } void ProgressTable::clearTableOutput(WriteBufferFromFileDescriptor & message) @@ -371,7 +362,6 @@ void ProgressTable::resetTable() std::lock_guard lock{mutex}; watch.restart(); metrics.clear(); - written_first_block = false; } size_t ProgressTable::tableSize() const diff --git a/src/Client/ProgressTable.h b/src/Client/ProgressTable.h index f2563d91217..64798079561 100644 --- a/src/Client/ProgressTable.h +++ b/src/Client/ProgressTable.h @@ -101,8 +101,6 @@ private: /// Track query execution time on client. Stopwatch watch; - bool written_first_block = false; - size_t column_event_name_width = 20; static constexpr std::string_view COLUMN_EVENT_NAME = "Event name";