mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 10:31:57 +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,
|
// 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.
|
// 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_BY_CLIENT;
|
||||||
extern const int QUERY_WAS_CANCELLED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -457,7 +456,7 @@ void TCPHandler::runImpl()
|
|||||||
SCOPE_EXIT({
|
SCOPE_EXIT({
|
||||||
if (exception)
|
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));
|
LOG_INFO(log, getExceptionMessageAndPattern(*exception, send_exception_with_stack_trace));
|
||||||
else
|
else
|
||||||
LOG_ERROR(log, getExceptionMessageAndPattern(*exception, send_exception_with_stack_trace));
|
LOG_ERROR(log, getExceptionMessageAndPattern(*exception, send_exception_with_stack_trace));
|
||||||
@ -782,8 +781,7 @@ void TCPHandler::runImpl()
|
|||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
//LOG_DEBUG(log, "query_state->io.onException()");
|
query_state->io.onException(exception_code != ErrorCodes::QUERY_WAS_CANCELLED_BY_CLIENT);
|
||||||
query_state->io.onException(exception_code != ErrorCodes::QUERY_WAS_CANCELLED_BY_CLIENT && exception_code != ErrorCodes::QUERY_WAS_CANCELLED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Authentication failure with interserver secret
|
/// Authentication failure with interserver secret
|
||||||
@ -841,7 +839,7 @@ void TCPHandler::runImpl()
|
|||||||
if (!query_state->read_all_data)
|
if (!query_state->read_all_data)
|
||||||
skipData(query_state.value());
|
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");
|
LOG_DEBUG(log, "try send EndOfStream");
|
||||||
sendEndOfStream(query_state.value());
|
sendEndOfStream(query_state.value());
|
||||||
@ -2365,7 +2363,7 @@ void TCPHandler::initProfileEventsBlockOutput(QueryState & state, const Block &
|
|||||||
void TCPHandler::checkIfQueryCanceled(QueryState & state)
|
void TCPHandler::checkIfQueryCanceled(QueryState & state)
|
||||||
{
|
{
|
||||||
if (state.stop_query)
|
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)
|
void TCPHandler::processCancel(QueryState & state, bool throw_exception)
|
||||||
@ -2383,7 +2381,7 @@ void TCPHandler::processCancel(QueryState & state, bool throw_exception)
|
|||||||
state.stop_query = true;
|
state.stop_query = true;
|
||||||
|
|
||||||
if (throw_exception)
|
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
|
else
|
||||||
LOG_INFO(log, "Received 'Cancel' packet from the client. Queries callbacks return nothing.");
|
LOG_INFO(log, "Received 'Cancel' packet from the client. Queries callbacks return nothing.");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user