mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 16:50:48 +00:00
Prevent hedged connections overlaps
Some replicas may be in the establishing state, this means that hedged connection is waiting for TablesStatusResponse, and if the connection will not be canceled, then next user of the connection will get TablesStatusResponse, while this is not the expected package, and you will see: DB::Exception: Received from localhost:9000. DB::Exception: Received from ch-1:9000. DB::Exception: Unknown packet 9 from server ch-2:9000: While executing Remote. Stack trace: Fix this by disconnecting connection to such replicas, note that this should be fine in general, since they are "slow" anyway (you may wish configure hedged requests settings to increase timeouts and similar).
This commit is contained in:
parent
95c87d4ded
commit
17eaddc3ab
@ -38,6 +38,16 @@ HedgedConnectionsFactory::HedgedConnectionsFactory(
|
||||
|
||||
HedgedConnectionsFactory::~HedgedConnectionsFactory()
|
||||
{
|
||||
/// Stop anything that maybe in progress,
|
||||
/// to avoid interfer with the subsequent connections.
|
||||
///
|
||||
/// I.e. some replcas may be in the establishing state,
|
||||
/// this means that hedged connection is waiting for TablesStatusResponse,
|
||||
/// and if the connection will not be canceled,
|
||||
/// then next user of the connection will get TablesStatusResponse,
|
||||
/// while this is not the expected package.
|
||||
stopChoosingReplicas();
|
||||
|
||||
pool->updateSharedError(shuffled_pools);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user