Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not restore previous cursor if send_logs_level is used #9634

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 15 additions & 5 deletions dbms/programs/client/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class Client : public Poco::Util::Application
};
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 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.
Expand Down Expand Up @@ -817,6 +818,8 @@ class Client : public Poco::Util::Application

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);
Expand Down Expand Up @@ -1435,7 +1438,8 @@ class Client : public Poco::Util::Application
void clearProgress()
{
written_progress_chars = 0;
std::cerr << RESTORE_CURSOR_POSITION CLEAR_TO_END_OF_LINE;
if (!send_logs)
std::cerr << RESTORE_CURSOR_POSITION CLEAR_TO_END_OF_LINE;
}


Expand All @@ -1460,10 +1464,13 @@ class Client : public Poco::Util::Application
"\033[1m↗\033[0m",
};

if (written_progress_chars)
message << RESTORE_CURSOR_POSITION CLEAR_TO_END_OF_LINE;
else
message << SAVE_CURSOR_POSITION;
if (!send_logs)
{
if (written_progress_chars)
message << RESTORE_CURSOR_POSITION CLEAR_TO_END_OF_LINE;
else
message << SAVE_CURSOR_POSITION;
}

message << DISABLE_LINE_WRAPPING;

Expand Down Expand Up @@ -1518,6 +1525,9 @@ class Client : public Poco::Util::Application
}

message << ENABLE_LINE_WRAPPING;
if (send_logs)
message << '\n';

++increment;

message.next();
Expand Down