mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Revert extra changed lines
That was the changes that looks OK for the initial patchset version, but not now, after all review comments. Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
parent
fe613ddd06
commit
a19b27bd7c
@ -95,7 +95,6 @@ void ConnectionEstablisher::run(ConnectionEstablisher::TryResult & result, std::
|
||||
|
||||
LOG_TRACE(log, "Server {} has unacceptable replica delay for table {}.{}: {}", result.entry->getDescription(), table_to_check->database, table_to_check->table, delay);
|
||||
ProfileEvents::increment(ProfileEvents::DistributedConnectionStaleReplica);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (const Exception & e)
|
||||
|
@ -62,14 +62,13 @@ public:
|
||||
|
||||
/// The same as getMany(), but return std::vector<TryResult>.
|
||||
std::vector<TryResult> getManyForTableFunction(const ConnectionTimeouts & timeouts,
|
||||
const Settings & settings,
|
||||
PoolMode pool_mode);
|
||||
const Settings & settings, PoolMode pool_mode);
|
||||
|
||||
using Base = PoolWithFailoverBase<IConnectionPool>;
|
||||
using TryResult = Base::TryResult;
|
||||
|
||||
/// The same as getMany(), but check that:
|
||||
/// - replication delay for table_to_check is acceptable (delay threshold is taken from settings)
|
||||
/// The same as getMany(), but check that replication delay for table_to_check is acceptable.
|
||||
/// Delay threshold is taken from settings.
|
||||
std::vector<TryResult> getManyChecked(
|
||||
const ConnectionTimeouts & timeouts,
|
||||
const Settings & settings,
|
||||
|
@ -293,12 +293,14 @@ PoolWithFailoverBase<TNestedPool>::getMany(
|
||||
|
||||
std::erase_if(try_results, [](const TryResult & r) { return r.entry.isNull() || !r.is_usable; });
|
||||
|
||||
auto comparator = [&](const TryResult & left, const TryResult & right)
|
||||
{
|
||||
return std::forward_as_tuple(!left.is_up_to_date, left.delay)
|
||||
< std::forward_as_tuple(!right.is_up_to_date, right.delay);
|
||||
};
|
||||
std::stable_sort(try_results.begin(), try_results.end(), comparator);
|
||||
/// Sort so that preferred items are near the beginning.
|
||||
std::stable_sort(
|
||||
try_results.begin(), try_results.end(),
|
||||
[](const TryResult & left, const TryResult & right)
|
||||
{
|
||||
return std::forward_as_tuple(!left.is_up_to_date, left.delay)
|
||||
< std::forward_as_tuple(!right.is_up_to_date, right.delay);
|
||||
});
|
||||
|
||||
if (fallback_to_stale_replicas)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user