MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / tryGetEntry

Method tryGetEntry

src/Client/ConnectionPoolWithFailover.cpp:244–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244ConnectionPoolWithFailover::TryResult
245ConnectionPoolWithFailover::tryGetEntry(
246 const ConnectionPoolPtr & pool,
247 const ConnectionTimeouts & timeouts,
248 std::string & fail_message,
249 const Settings & settings,
250 const QualifiedTableName * table_to_check,
251 [[maybe_unused]] AsyncCallback async_callback,
252 bool force_connected)
253{
254#if defined(OS_LINUX)
255 if (async_callback)
256 {
257 ConnectionEstablisherAsync connection_establisher_async(pool, &timeouts, settings, log, table_to_check);
258 while (true)
259 {
260 connection_establisher_async.resumeConnectionWithForceOption(force_connected);
261
262 if (connection_establisher_async.isFinished())
263 break;
264
265 async_callback(
266 connection_establisher_async.getFileDescriptor(),
267 0,
268 AsyncEventTimeoutType::NONE,
269 "Connection establisher file descriptor",
270 AsyncTaskExecutor::Event::READ | AsyncTaskExecutor::Event::ERROR);
271 }
272
273 fail_message = connection_establisher_async.getFailMessage();
274 return connection_establisher_async.getResult();
275 }
276#endif
277
278 ConnectionEstablisher connection_establisher(pool, &timeouts, settings, log, table_to_check);
279 TryResult result;
280 connection_establisher.run(result, fail_message, force_connected);
281 return result;
282}
283
284std::vector<ConnectionPoolWithFailover::Base::ShuffledPool>
285ConnectionPoolWithFailover::getShuffledPools(const Settings & settings, GetPriorityForLoadBalancing::Func priority_func, bool use_slowdown_count)

Callers

nothing calls this directly

Calls 5

isFinishedMethod · 0.45
getFileDescriptorMethod · 0.45
getResultMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected