mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Revert "Don't allow to set max_parallel_replicas to 0 as it doesn't make sense"
This commit is contained in:
parent
d03a4fa637
commit
a90a6e9a27
@ -21,7 +21,6 @@ namespace ErrorCodes
|
||||
{
|
||||
extern const int LOGICAL_ERROR;
|
||||
extern const int ALL_CONNECTION_TRIES_FAILED;
|
||||
extern const int BAD_ARGUMENTS;
|
||||
}
|
||||
|
||||
|
||||
@ -192,20 +191,11 @@ std::vector<ConnectionPoolWithFailover::TryResult> ConnectionPoolWithFailover::g
|
||||
max_entries = nested_pools.size();
|
||||
}
|
||||
else if (pool_mode == PoolMode::GET_ONE)
|
||||
{
|
||||
max_entries = 1;
|
||||
}
|
||||
else if (pool_mode == PoolMode::GET_MANY)
|
||||
{
|
||||
if (settings.max_parallel_replicas == 0)
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "The value of the setting max_parallel_replicas must be greater than 0");
|
||||
|
||||
max_entries = settings.max_parallel_replicas;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw DB::Exception(DB::ErrorCodes::LOGICAL_ERROR, "Unknown pool allocation mode");
|
||||
}
|
||||
|
||||
if (!priority_func)
|
||||
priority_func = makeGetPriorityFunc(settings);
|
||||
|
@ -19,7 +19,6 @@ namespace ErrorCodes
|
||||
extern const int ALL_CONNECTION_TRIES_FAILED;
|
||||
extern const int ALL_REPLICAS_ARE_STALE;
|
||||
extern const int LOGICAL_ERROR;
|
||||
extern const int BAD_ARGUMENTS;
|
||||
}
|
||||
|
||||
HedgedConnectionsFactory::HedgedConnectionsFactory(
|
||||
@ -83,10 +82,7 @@ std::vector<Connection *> HedgedConnectionsFactory::getManyConnections(PoolMode
|
||||
}
|
||||
case PoolMode::GET_MANY:
|
||||
{
|
||||
if (max_parallel_replicas == 0)
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "The value of the setting max_parallel_replicas must be greater than 0");
|
||||
|
||||
max_entries = std::min(max_parallel_replicas, shuffled_pools.size());
|
||||
max_entries = max_parallel_replicas;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ private:
|
||||
/// checking the number of requested replicas that are still in process).
|
||||
size_t requested_connections_count = 0;
|
||||
|
||||
const size_t max_parallel_replicas = 1;
|
||||
const size_t max_parallel_replicas = 0;
|
||||
const bool skip_unavailable_shards = 0;
|
||||
};
|
||||
|
||||
|
@ -947,7 +947,7 @@ bool InterpreterSelectQuery::adjustParallelReplicasAfterAnalysis()
|
||||
if (number_of_replicas_to_use <= 1)
|
||||
{
|
||||
context->setSetting("allow_experimental_parallel_reading_from_replicas", Field(0));
|
||||
context->setSetting("max_parallel_replicas", UInt64{1});
|
||||
context->setSetting("max_parallel_replicas", UInt64{0});
|
||||
LOG_DEBUG(log, "Disabling parallel replicas because there aren't enough rows to read");
|
||||
return true;
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ bool applyTrivialCountIfPossible(
|
||||
|
||||
/// The query could use trivial count if it didn't use parallel replicas, so let's disable it
|
||||
query_context->setSetting("allow_experimental_parallel_reading_from_replicas", Field(0));
|
||||
query_context->setSetting("max_parallel_replicas", UInt64{1});
|
||||
query_context->setSetting("max_parallel_replicas", UInt64{0});
|
||||
LOG_TRACE(getLogger("Planner"), "Disabling parallel replicas to be able to use a trivial count optimization");
|
||||
|
||||
}
|
||||
@ -756,7 +756,7 @@ JoinTreeQueryPlan buildQueryPlanForTableExpression(QueryTreeNodePtr table_expres
|
||||
{
|
||||
planner_context->getMutableQueryContext()->setSetting(
|
||||
"allow_experimental_parallel_reading_from_replicas", Field(0));
|
||||
planner_context->getMutableQueryContext()->setSetting("max_parallel_replicas", UInt64{1});
|
||||
planner_context->getMutableQueryContext()->setSetting("max_parallel_replicas", UInt64{0});
|
||||
LOG_DEBUG(getLogger("Planner"), "Disabling parallel replicas because there aren't enough rows to read");
|
||||
}
|
||||
else if (number_of_replicas_to_use < settings.max_parallel_replicas)
|
||||
|
@ -1,5 +0,0 @@
|
||||
drop table if exists test_d;
|
||||
create table test_d engine=Distributed(test_cluster_two_shard_three_replicas_localhost, system, numbers);
|
||||
select * from test_d limit 10 settings max_parallel_replicas = 0, prefer_localhost_replica = 0; --{serverError BAD_ARGUMENTS}
|
||||
drop table test_d;
|
||||
|
Loading…
Reference in New Issue
Block a user