Merge pull request #64888 from azat/client-cancelled-message

Fix possible loss of "Query was cancelled" message in client (fixes 03023_zeros_generate_random_with_limit_progress_bar flakiness)
This commit is contained in:
János Benjamin Antal 2024-06-13 12:24:27 +00:00 committed by GitHub
commit 5cff2bca77
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 2 deletions

View File

@ -1188,7 +1188,10 @@ void ClientBase::receiveResult(ASTPtr parsed_query, Int32 signals_before_stop, b
std::rethrow_exception(local_format_error);
if (cancelled && is_interactive)
{
std::cout << "Query was cancelled." << std::endl;
cancelled_printed = true;
}
}
@ -1302,8 +1305,13 @@ void ClientBase::onEndOfStream()
resetOutput();
if (is_interactive && !written_first_block)
std::cout << "Ok." << std::endl;
if (is_interactive)
{
if (cancelled && !cancelled_printed)
std::cout << "Query was cancelled." << std::endl;
else if (!written_first_block)
std::cout << "Ok." << std::endl;
}
}
@ -1866,6 +1874,7 @@ void ClientBase::processParsedSingleQuery(const String & full_query, const Strin
resetOutput();
have_error = false;
cancelled = false;
cancelled_printed = false;
client_exception.reset();
server_exception.reset();

View File

@ -329,6 +329,7 @@ protected:
bool allow_merge_tree_settings = false;
bool cancelled = false;
bool cancelled_printed = false;
/// Does log_comment has specified by user?
bool has_log_comment = false;