mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-18 20:32:43 +00:00
Add cancel reason CANCELLED_BY_ERROR.
This commit is contained in:
parent
78a7e0b840
commit
29bf43eaf2
@ -21,6 +21,8 @@ namespace ErrorCodes
|
|||||||
{
|
{
|
||||||
extern const int FAILED_TO_SYNC_BACKUP_OR_RESTORE;
|
extern const int FAILED_TO_SYNC_BACKUP_OR_RESTORE;
|
||||||
extern const int LOGICAL_ERROR;
|
extern const int LOGICAL_ERROR;
|
||||||
|
extern const int QUERY_WAS_CANCELLED;
|
||||||
|
extern const int QUERY_WAS_CANCELLED_BY_CLIENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -692,7 +694,12 @@ void BackupCoordinationStageSync::cancelQueryIfError()
|
|||||||
if (!exception)
|
if (!exception)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
process_list_element->cancelQuery(CancelReason::CANCELLED_BY_USER, exception);
|
auto code = getExceptionErrorCode(exception);
|
||||||
|
auto cancel_reason = ((code == ErrorCodes::QUERY_WAS_CANCELLED) || (code == ErrorCodes::QUERY_WAS_CANCELLED_BY_CLIENT))
|
||||||
|
? CancelReason::CANCELLED_BY_USER
|
||||||
|
: CancelReason::CANCELLED_BY_ERROR;
|
||||||
|
|
||||||
|
process_list_element->cancelQuery(cancel_reason, exception);
|
||||||
|
|
||||||
state_changed.notify_all();
|
state_changed.notify_all();
|
||||||
}
|
}
|
||||||
@ -747,7 +754,7 @@ void BackupCoordinationStageSync::cancelQueryIfDisconnectedTooLong()
|
|||||||
/// we don't want the watching thread to try waiting here for retries or a reconnection).
|
/// we don't want the watching thread to try waiting here for retries or a reconnection).
|
||||||
/// Also we don't set the `state.host_with_error` field here because `state.host_with_error` can only be set
|
/// Also we don't set the `state.host_with_error` field here because `state.host_with_error` can only be set
|
||||||
/// AFTER creating the 'error' node (see the comment for `State`).
|
/// AFTER creating the 'error' node (see the comment for `State`).
|
||||||
process_list_element->cancelQuery(CancelReason::CANCELLED_BY_USER, exception);
|
process_list_element->cancelQuery(CancelReason::CANCELLED_BY_ERROR, exception);
|
||||||
|
|
||||||
state_changed.notify_all();
|
state_changed.notify_all();
|
||||||
}
|
}
|
||||||
|
@ -464,12 +464,11 @@ CancellationCode QueryStatus::cancelQuery(CancelReason reason, std::exception_pt
|
|||||||
if (is_killed)
|
if (is_killed)
|
||||||
return CancellationCode::CancelSent;
|
return CancellationCode::CancelSent;
|
||||||
|
|
||||||
|
LOG_TRACE(getLogger("ProcessList"), "Cancelling the query (reason: {})", reason);
|
||||||
|
|
||||||
is_killed = true;
|
is_killed = true;
|
||||||
|
|
||||||
if (!cancellation_exception)
|
|
||||||
cancellation_exception = exception;
|
|
||||||
|
|
||||||
cancel_reason = reason;
|
cancel_reason = reason;
|
||||||
|
cancellation_exception = exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ExecutorHolderPtr> executors_snapshot;
|
std::vector<ExecutorHolderPtr> executors_snapshot;
|
||||||
|
@ -48,6 +48,7 @@ enum CancelReason
|
|||||||
UNDEFINED,
|
UNDEFINED,
|
||||||
TIMEOUT,
|
TIMEOUT,
|
||||||
CANCELLED_BY_USER,
|
CANCELLED_BY_USER,
|
||||||
|
CANCELLED_BY_ERROR,
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Information of process list element.
|
/** Information of process list element.
|
||||||
|
Loading…
Reference in New Issue
Block a user