fix parallel replicas display in interactive metrics

This commit is contained in:
Julia Kartseva 2024-11-06 02:05:19 +00:00
parent a111db7e47
commit 0cf896f5a0
2 changed files with 3 additions and 15 deletions

View File

@ -197,7 +197,6 @@ void ProgressTable::writeTable(WriteBufferFromFileDescriptor & message, bool sho
std::lock_guard lock{mutex}; std::lock_guard lock{mutex};
if (!show_table && toggle_enabled) 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 << HIDE_CURSOR;
@ -341,12 +340,7 @@ void ProgressTable::updateTable(const Block & block)
continue; continue;
auto it = metrics.find(name); auto it = metrics.find(name);
if (it == metrics.end())
/// 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)
it = metrics.try_emplace(name).first; it = metrics.try_emplace(name).first;
it->second.updateHostValue(host_name, type, value, time_now); 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()); 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; column_event_name_width = max_event_name_width + 1;
written_first_block = true;
} }
void ProgressTable::clearTableOutput(WriteBufferFromFileDescriptor & message) void ProgressTable::clearTableOutput(WriteBufferFromFileDescriptor & message)
@ -371,7 +362,6 @@ void ProgressTable::resetTable()
std::lock_guard lock{mutex}; std::lock_guard lock{mutex};
watch.restart(); watch.restart();
metrics.clear(); metrics.clear();
written_first_block = false;
} }
size_t ProgressTable::tableSize() const size_t ProgressTable::tableSize() const

View File

@ -101,8 +101,6 @@ private:
/// Track query execution time on client. /// Track query execution time on client.
Stopwatch watch; Stopwatch watch;
bool written_first_block = false;
size_t column_event_name_width = 20; size_t column_event_name_width = 20;
static constexpr std::string_view COLUMN_EVENT_NAME = "Event name"; static constexpr std::string_view COLUMN_EVENT_NAME = "Event name";