mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Fix max_distributed_connections (one more time)
With prefer_localhost_replica=1 max_distributed_connections uses max_threads before this patch. Fixes: #14936 Previous fix: #9673
This commit is contained in:
parent
e62ef0ab56
commit
c3a4e5e7b7
@ -1550,7 +1550,12 @@ void InterpreterSelectQuery::executeFetchColumns(
|
|||||||
throw Exception("Logical error in InterpreterSelectQuery: nowhere to read", ErrorCodes::LOGICAL_ERROR);
|
throw Exception("Logical error in InterpreterSelectQuery: nowhere to read", ErrorCodes::LOGICAL_ERROR);
|
||||||
|
|
||||||
/// Specify the number of threads only if it wasn't specified in storage.
|
/// Specify the number of threads only if it wasn't specified in storage.
|
||||||
if (!query_plan.getMaxThreads())
|
///
|
||||||
|
/// But in case of remote query and prefer_localhost_replica=1 (default)
|
||||||
|
/// The inner local query (that is done in the same process, without
|
||||||
|
/// network interaction), it will setMaxThreads earlier and distributed
|
||||||
|
/// query will not update it.
|
||||||
|
if (!query_plan.getMaxThreads() || is_remote)
|
||||||
query_plan.setMaxThreads(max_threads_execute_query);
|
query_plan.setMaxThreads(max_threads_execute_query);
|
||||||
|
|
||||||
/// Aliases in table declaration.
|
/// Aliases in table declaration.
|
||||||
|
15
tests/queries/0_stateless/01602_max_distributed_connections.sh
Executable file
15
tests/queries/0_stateless/01602_max_distributed_connections.sh
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||||
|
. "$CURDIR"/../shell_config.sh
|
||||||
|
|
||||||
|
common_opts=(
|
||||||
|
"--format=Null"
|
||||||
|
|
||||||
|
"--max_threads=1"
|
||||||
|
"--max_distributed_connections=3"
|
||||||
|
)
|
||||||
|
|
||||||
|
# NOTE: the test use higher timeout to avoid flakiness.
|
||||||
|
timeout 9s ${CLICKHOUSE_CLIENT} "$@" "${common_opts[@]}" -q "select sleep(3) from remote('127.{1,2,3,4,5}', system.one)" --prefer_localhost_replica=0
|
||||||
|
timeout 9s ${CLICKHOUSE_CLIENT} "$@" "${common_opts[@]}" -q "select sleep(3) from remote('127.{1,2,3,4,5}', system.one)" --prefer_localhost_replica=1
|
Loading…
Reference in New Issue
Block a user