mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-13 02:53:38 +00:00
Change CLICKHOUSE_TERMINATE_ON_ANY_EXCEPTION abort for quick_exit
This commit is contained in:
parent
0523e6cbd0
commit
36922102f6
@ -51,7 +51,7 @@ void abortOnFailedAssertion(const String & description)
|
||||
}
|
||||
|
||||
bool terminate_on_any_exception = false;
|
||||
|
||||
static int terminate_status_code = 128 + SIGABRT;
|
||||
thread_local bool update_error_statistics = true;
|
||||
|
||||
/// - Aborts the process if error code is LOGICAL_ERROR.
|
||||
@ -92,7 +92,7 @@ Exception::Exception(const MessageMasked & msg_masked, int code, bool remote_)
|
||||
, remote(remote_)
|
||||
{
|
||||
if (terminate_on_any_exception)
|
||||
std::terminate();
|
||||
std::quick_exit(terminate_status_code);
|
||||
capture_thread_frame_pointers = thread_frame_pointers;
|
||||
handle_error_code(msg_masked.msg, code, remote, getStackFramePointers());
|
||||
}
|
||||
@ -102,7 +102,7 @@ Exception::Exception(MessageMasked && msg_masked, int code, bool remote_)
|
||||
, remote(remote_)
|
||||
{
|
||||
if (terminate_on_any_exception)
|
||||
std::terminate();
|
||||
std::quick_exit(terminate_status_code);
|
||||
capture_thread_frame_pointers = thread_frame_pointers;
|
||||
handle_error_code(message(), code, remote, getStackFramePointers());
|
||||
}
|
||||
@ -111,7 +111,7 @@ Exception::Exception(CreateFromPocoTag, const Poco::Exception & exc)
|
||||
: Poco::Exception(exc.displayText(), ErrorCodes::POCO_EXCEPTION)
|
||||
{
|
||||
if (terminate_on_any_exception)
|
||||
std::terminate();
|
||||
std::quick_exit(terminate_status_code);
|
||||
capture_thread_frame_pointers = thread_frame_pointers;
|
||||
#ifdef STD_EXCEPTION_HAS_STACK_TRACE
|
||||
auto * stack_trace_frames = exc.get_stack_trace_frames();
|
||||
@ -125,7 +125,7 @@ Exception::Exception(CreateFromSTDTag, const std::exception & exc)
|
||||
: Poco::Exception(demangle(typeid(exc).name()) + ": " + String(exc.what()), ErrorCodes::STD_EXCEPTION)
|
||||
{
|
||||
if (terminate_on_any_exception)
|
||||
std::terminate();
|
||||
std::quick_exit(terminate_status_code);
|
||||
capture_thread_frame_pointers = thread_frame_pointers;
|
||||
#ifdef STD_EXCEPTION_HAS_STACK_TRACE
|
||||
auto * stack_trace_frames = exc.get_stack_trace_frames();
|
||||
|
@ -1,4 +1,4 @@
|
||||
Aborted
|
||||
Failed
|
||||
1
|
||||
1
|
||||
1
|
||||
|
@ -7,27 +7,19 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
export CLICKHOUSE_TERMINATE_ON_ANY_EXCEPTION=1
|
||||
|
||||
# The environment variable works as expected:
|
||||
bash -c "
|
||||
abort_handler()
|
||||
{
|
||||
exit 0
|
||||
}
|
||||
trap 'abort_handler' ABRT
|
||||
$CLICKHOUSE_LOCAL --query 'this is wrong'
|
||||
" 2>&1 | grep -o 'Aborted'
|
||||
|
||||
$CLICKHOUSE_LOCAL --query 'this is wrong' || echo "Failed"
|
||||
# No exceptions are thrown in simple cases:
|
||||
$CLICKHOUSE_LOCAL --query "SELECT 1"
|
||||
$CLICKHOUSE_LOCAL --query "SHOW TABLES"
|
||||
$CLICKHOUSE_LOCAL --query "SELECT * FROM system.tables WHERE database = currentDatabase() FORMAT Null"
|
||||
$CLICKHOUSE_LOCAL --query "SELECT 1" || echo "Failed"
|
||||
$CLICKHOUSE_LOCAL --query "SHOW TABLES" || echo "Failed"
|
||||
$CLICKHOUSE_LOCAL --query "SELECT * FROM system.tables WHERE database = currentDatabase() FORMAT Null" || echo "Failed"
|
||||
|
||||
# The same for the client app:
|
||||
$CLICKHOUSE_CLIENT --query "SELECT 1"
|
||||
$CLICKHOUSE_CLIENT --query "SHOW TABLES"
|
||||
$CLICKHOUSE_CLIENT --query "SELECT * FROM system.tables WHERE database = currentDatabase() FORMAT Null"
|
||||
$CLICKHOUSE_CLIENT --query "SELECT 1" || echo "Failed"
|
||||
$CLICKHOUSE_CLIENT --query "SHOW TABLES" || echo "Failed"
|
||||
$CLICKHOUSE_CLIENT --query "SELECT * FROM system.tables WHERE database = currentDatabase() FORMAT Null" || echo "Failed"
|
||||
|
||||
# Multi queries are ok:
|
||||
$CLICKHOUSE_LOCAL --multiquery "SELECT 1; SELECT 2;"
|
||||
$CLICKHOUSE_LOCAL --multiquery "SELECT 1; SELECT 2;" || echo "Failed"
|
||||
|
||||
# It can run in interactive mode:
|
||||
function run()
|
||||
|
Loading…
Reference in New Issue
Block a user