mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
Merge pull request #67389 from ClickHouse/pr-all-connection-failed
Try to fix: ALL_CONNECTION_TRIES_FAILED with parallel replicas
This commit is contained in:
commit
feeb945461
@ -33,12 +33,12 @@ ConnectionEstablisher::ConnectionEstablisher(
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionEstablisher::run(ConnectionEstablisher::TryResult & result, std::string & fail_message)
|
void ConnectionEstablisher::run(ConnectionEstablisher::TryResult & result, std::string & fail_message, bool force_connected)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ProfileEvents::increment(ProfileEvents::DistributedConnectionTries);
|
ProfileEvents::increment(ProfileEvents::DistributedConnectionTries);
|
||||||
result.entry = pool->get(*timeouts, settings, /* force_connected = */ false);
|
result.entry = pool->get(*timeouts, settings, force_connected);
|
||||||
AsyncCallbackSetter async_setter(&*result.entry, std::move(async_callback));
|
AsyncCallbackSetter async_setter(&*result.entry, std::move(async_callback));
|
||||||
|
|
||||||
UInt64 server_revision = 0;
|
UInt64 server_revision = 0;
|
||||||
|
@ -24,7 +24,13 @@ public:
|
|||||||
const QualifiedTableName * table_to_check = nullptr);
|
const QualifiedTableName * table_to_check = nullptr);
|
||||||
|
|
||||||
/// Establish connection and save it in result, write possible exception message in fail_message.
|
/// Establish connection and save it in result, write possible exception message in fail_message.
|
||||||
void run(TryResult & result, std::string & fail_message);
|
/// The connection is returned from connection pool and it can be stale. Use force_connected flag to ensure that connection is working one.
|
||||||
|
/// NOTE: force_connected is false by default due to the following consideration ...
|
||||||
|
/// When true, it implies sending a Ping packet to another peer and, if it fails - reestablishing the connection.
|
||||||
|
/// Ping-Pong round trip can be unnecessary in case of connection is still alive.
|
||||||
|
/// So, the optimistic approach is used by default. In this case, stale connections can be handled by retrying,
|
||||||
|
/// - see ConnectionPoolWithFailover, as example
|
||||||
|
void run(TryResult & result, std::string & fail_message, bool force_connected = false);
|
||||||
|
|
||||||
/// Set async callback that will be called when reading from socket blocks.
|
/// Set async callback that will be called when reading from socket blocks.
|
||||||
void setAsyncCallback(AsyncCallback async_callback_) { async_callback = std::move(async_callback_); }
|
void setAsyncCallback(AsyncCallback async_callback_) { async_callback = std::move(async_callback_); }
|
||||||
|
@ -89,12 +89,12 @@ RemoteQueryExecutor::RemoteQueryExecutor(
|
|||||||
auto table_name = main_table.getQualifiedName();
|
auto table_name = main_table.getQualifiedName();
|
||||||
|
|
||||||
ConnectionEstablisher connection_establisher(pool, &timeouts, current_settings, log, &table_name);
|
ConnectionEstablisher connection_establisher(pool, &timeouts, current_settings, log, &table_name);
|
||||||
connection_establisher.run(result, fail_message);
|
connection_establisher.run(result, fail_message, /*force_connected=*/ true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ConnectionEstablisher connection_establisher(pool, &timeouts, current_settings, log, nullptr);
|
ConnectionEstablisher connection_establisher(pool, &timeouts, current_settings, log, nullptr);
|
||||||
connection_establisher.run(result, fail_message);
|
connection_establisher.run(result, fail_message, /*force_connected=*/ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<IConnectionPool::Entry> connection_entries;
|
std::vector<IConnectionPool::Entry> connection_entries;
|
||||||
|
Loading…
Reference in New Issue
Block a user