mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Fix possible assert in ~PushingAsyncPipelineExecutor in clickhouse-local
This commit is contained in:
parent
40ce9cf9ed
commit
1cbd4ff2d6
@ -35,6 +35,9 @@ LocalConnection::LocalConnection(ContextPtr context_, bool send_progress_, bool
|
||||
|
||||
LocalConnection::~LocalConnection()
|
||||
{
|
||||
/// Last query can be not finished or cancelled due to exception on client side.
|
||||
if (state && !state->is_finished && !state->is_cancelled)
|
||||
sendCancel();
|
||||
state.reset();
|
||||
}
|
||||
|
||||
@ -73,6 +76,10 @@ void LocalConnection::sendQuery(
|
||||
bool,
|
||||
std::function<void(const Progress &)> process_progress_callback)
|
||||
{
|
||||
/// Last query can be not finished or cancelled due to exception on client side.
|
||||
if (state && !state->is_finished && !state->is_cancelled)
|
||||
sendCancel();
|
||||
|
||||
/// Suggestion comes without client_info.
|
||||
if (client_info)
|
||||
query_context = session.makeQueryContext(*client_info);
|
||||
@ -204,6 +211,10 @@ void LocalConnection::sendCancel()
|
||||
state->is_cancelled = true;
|
||||
if (state->executor)
|
||||
state->executor->cancel();
|
||||
if (state->pushing_executor)
|
||||
state->pushing_executor->cancel();
|
||||
if (state->pushing_async_executor)
|
||||
state->pushing_async_executor->cancel();
|
||||
}
|
||||
|
||||
bool LocalConnection::pullBlock(Block & block)
|
||||
|
1
tests/queries/0_stateless/02841_local_assert.reference
Normal file
1
tests/queries/0_stateless/02841_local_assert.reference
Normal file
@ -0,0 +1 @@
|
||||
1
|
18
tests/queries/0_stateless/02841_local_assert.sh
Executable file
18
tests/queries/0_stateless/02841_local_assert.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CUR_DIR"/../shell_config.sh
|
||||
|
||||
echo "create table test (x UInt64) engine=Memory;
|
||||
insert into test from infile 'data'; -- {clientError BAD_ARGUMENTS}" | $CLICKHOUSE_LOCAL -nm
|
||||
|
||||
echo "create table test (x UInt64) engine=Memory;
|
||||
insert into test from infile 'data';" | $CLICKHOUSE_LOCAL -nm --ignore-error
|
||||
|
||||
echo "create table test (x UInt64) engine=Memory;
|
||||
insert into test from infile 'data'; -- {clientError BAD_ARGUMENTS}
|
||||
select 1" | $CLICKHOUSE_LOCAL -nm
|
||||
|
Loading…
Reference in New Issue
Block a user