Set max_entries to min(max_parallel_replicas, all available reolicas)

This commit is contained in:
Kruglov Pavel 2024-02-27 14:31:35 +01:00 committed by GitHub
parent f264f0a036
commit 58a53b42ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -86,7 +86,7 @@ std::vector<Connection *> HedgedConnectionsFactory::getManyConnections(PoolMode
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 = max_parallel_replicas;
max_entries = std::min(max_parallel_replicas, shuffled_pools.size());
break;
}
}