mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
fix deadlock in async inserts via native protocol
This commit is contained in:
parent
820916b925
commit
b9d6f4b3ed
@ -936,6 +936,8 @@ void TCPHandler::processInsertQuery()
|
||||
auto result = processAsyncInsertQuery(*insert_queue);
|
||||
if (result.status == AsynchronousInsertQueue::PushResult::OK)
|
||||
{
|
||||
/// Reset pipeline because it may hold write lock for some storages.
|
||||
state.io.pipeline.reset();
|
||||
if (settings.wait_for_async_insert)
|
||||
{
|
||||
size_t timeout_ms = settings.wait_for_async_insert_timeout.totalMilliseconds();
|
||||
@ -968,7 +970,7 @@ void TCPHandler::processInsertQuery()
|
||||
else
|
||||
{
|
||||
PushingPipelineExecutor executor(state.io.pipeline);
|
||||
run_executor(executor, processed_block);
|
||||
run_executor(executor, std::move(processed_block));
|
||||
}
|
||||
|
||||
sendInsertProfileEvents();
|
||||
|
@ -0,0 +1 @@
|
||||
1
|
12
tests/queries/0_stateless/03006_async_insert_deadlock_log.sh
Executable file
12
tests/queries/0_stateless/03006_async_insert_deadlock_log.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CURDIR"/../shell_config.sh
|
||||
|
||||
$CLICKHOUSE_CLIENT --query "CREATE TABLE t_async_insert_deadlock (a UInt64) ENGINE = Log"
|
||||
|
||||
echo '{"a": 1}' | $CLICKHOUSE_CLIENT --async_insert 1 --wait_for_async_insert 1 --query "INSERT INTO t_async_insert_deadlock FORMAT JSONEachRow"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query "SELECT * FROM t_async_insert_deadlock ORDER BY a"
|
||||
$CLICKHOUSE_CLIENT --query "DROP TABLE t_async_insert_deadlock"
|
Loading…
Reference in New Issue
Block a user