mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
tcp cancel with QUERY_WAS_CANCELLED_BY_CLIENT
This commit is contained in:
parent
b2933280b2
commit
1c69a275a6
@ -161,7 +161,6 @@ namespace DB::ErrorCodes
|
||||
// When query is killed by `Protocol::Client::Cancel` packet we just stop execution,
|
||||
// there is no need to send the exception which has been caused by the cancel packet.
|
||||
extern const int QUERY_WAS_CANCELLED_BY_CLIENT;
|
||||
extern const int QUERY_WAS_CANCELLED;
|
||||
}
|
||||
|
||||
namespace
|
||||
@ -457,7 +456,7 @@ void TCPHandler::runImpl()
|
||||
SCOPE_EXIT({
|
||||
if (exception)
|
||||
{
|
||||
if (exception->code() == ErrorCodes::QUERY_WAS_CANCELLED_BY_CLIENT || exception->code() == ErrorCodes::QUERY_WAS_CANCELLED)
|
||||
if (exception->code() == ErrorCodes::QUERY_WAS_CANCELLED_BY_CLIENT)
|
||||
LOG_INFO(log, getExceptionMessageAndPattern(*exception, send_exception_with_stack_trace));
|
||||
else
|
||||
LOG_ERROR(log, getExceptionMessageAndPattern(*exception, send_exception_with_stack_trace));
|
||||
@ -782,8 +781,7 @@ void TCPHandler::runImpl()
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
//LOG_DEBUG(log, "query_state->io.onException()");
|
||||
query_state->io.onException(exception_code != ErrorCodes::QUERY_WAS_CANCELLED_BY_CLIENT && exception_code != ErrorCodes::QUERY_WAS_CANCELLED);
|
||||
query_state->io.onException(exception_code != ErrorCodes::QUERY_WAS_CANCELLED_BY_CLIENT);
|
||||
}
|
||||
|
||||
/// Authentication failure with interserver secret
|
||||
@ -841,7 +839,7 @@ void TCPHandler::runImpl()
|
||||
if (!query_state->read_all_data)
|
||||
skipData(query_state.value());
|
||||
|
||||
if (exception_code == ErrorCodes::QUERY_WAS_CANCELLED_BY_CLIENT || exception_code == ErrorCodes::QUERY_WAS_CANCELLED)
|
||||
if (exception_code == ErrorCodes::QUERY_WAS_CANCELLED_BY_CLIENT)
|
||||
{
|
||||
LOG_DEBUG(log, "try send EndOfStream");
|
||||
sendEndOfStream(query_state.value());
|
||||
@ -2365,7 +2363,7 @@ void TCPHandler::initProfileEventsBlockOutput(QueryState & state, const Block &
|
||||
void TCPHandler::checkIfQueryCanceled(QueryState & state)
|
||||
{
|
||||
if (state.stop_query)
|
||||
throw Exception(ErrorCodes::QUERY_WAS_CANCELLED, "Packet 'Cancel' has been received from the client, canceling the query.");
|
||||
throw Exception(ErrorCodes::QUERY_WAS_CANCELLED_BY_CLIENT, "Packet 'Cancel' has been received from the client, canceling the query.");
|
||||
}
|
||||
|
||||
void TCPHandler::processCancel(QueryState & state, bool throw_exception)
|
||||
@ -2383,7 +2381,7 @@ void TCPHandler::processCancel(QueryState & state, bool throw_exception)
|
||||
state.stop_query = true;
|
||||
|
||||
if (throw_exception)
|
||||
throw Exception(ErrorCodes::QUERY_WAS_CANCELLED, "Received 'Cancel' packet from the client, canceling the query.");
|
||||
throw Exception(ErrorCodes::QUERY_WAS_CANCELLED_BY_CLIENT, "Received 'Cancel' packet from the client, canceling the query.");
|
||||
else
|
||||
LOG_INFO(log, "Received 'Cancel' packet from the client. Queries callbacks return nothing.");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user