mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Merge pull request #17848 from azat/max_distributed_connections-fix
Fix max_distributed_connections
This commit is contained in:
commit
31bef163ba
@ -1552,7 +1552,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