Do not render progress too much

This commit is contained in:
Alexey Milovidov 2020-06-22 22:16:48 +03:00
parent d3deed991e
commit c66f020a63

View File

@ -123,7 +123,7 @@ private:
};
bool is_interactive = true; /// Use either interactive line editing interface or batch mode.
bool need_render_progress = true; /// Render query execution progress.
bool send_logs = false; /// send_logs_level passed, do not use previous cursor position, to avoid overlaps with logs
bool has_received_logs = false; /// We have received some logs, do not use previous cursor position, to avoid overlaps with logs
bool echo_queries = false; /// Print queries before execution in batch mode.
bool ignore_error = false; /// In case of errors, don't print error message, continue to next query. Only applicable for non-interactive mode.
bool print_time_to_stderr = false; /// Output execution time to stderr in batch mode.
@ -908,8 +908,6 @@ private:
connection->forceConnected(connection_parameters.timeouts);
send_logs = context.getSettingsRef().send_logs_level != LogsLevel::none;
ASTPtr input_function;
if (insert && insert->select)
insert->tryFindInputFunction(input_function);
@ -1518,6 +1516,7 @@ private:
void onLogData(Block & block)
{
has_received_logs = true;
initLogsOutputStream();
logs_out_stream->write(block);
logs_out_stream->flush();
@ -1553,7 +1552,7 @@ private:
void clearProgress()
{
written_progress_chars = 0;
if (!send_logs)
if (!has_received_logs)
std::cerr << "\r" CLEAR_TO_END_OF_LINE;
}
@ -1581,7 +1580,7 @@ private:
const char * indicator = indicators[increment % 8];
if (!send_logs && written_progress_chars)
if (!has_received_logs && written_progress_chars)
message << '\r';
size_t prefix_size = message.count();
@ -1635,7 +1634,7 @@ private:
message << CLEAR_TO_END_OF_LINE;
if (send_logs)
if (has_received_logs)
message << '\n';
++increment;