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

Method poll

src/Client/LocalConnection.cpp:459–621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

457}
458
459bool LocalConnection::poll(size_t)
460{
461 if (!state)
462 return false;
463
464 /// Wait for next poll to collect current packet.
465 if (next_packet_type)
466 return true;
467
468 if (state->exception)
469 {
470 /// Flush any buffered logs before delivering the exception, otherwise
471 /// the user would not see log messages produced before the failure.
472 if (needSendLogs())
473 return true;
474
475 next_packet_type = Protocol::Server::Exception;
476 return true;
477 }
478
479 if (!state->is_finished)
480 {
481 if (needSendProgressOrMetrics())
482 return true;
483
484 if (needSendLogs())
485 return true;
486
487 try
488 {
489 while (pollImpl())
490 {
491 LOG_TEST(&Poco::Logger::get("LocalConnection"), "Executor timeout encountered, will retry");
492
493 if (needSendProgressOrMetrics())
494 return true;
495
496 if (needSendLogs())
497 return true;
498 }
499 }
500 catch (const Exception & e)
501 {
502 state->io.onException();
503 state->exception.reset(e.clone());
504 }
505 catch (const std::exception & e)
506 {
507 state->io.onException();
508 state->exception = std::make_unique<Exception>(Exception::CreateFromSTDTag{}, e);
509 }
510 catch (...) // Ok: wrap unknown exception for the client
511 {
512 state->io.onException();
513 state->exception = std::make_unique<Exception>(Exception(ErrorCodes::UNKNOWN_EXCEPTION, "Unknown exception"));
514 }
515 }
516

Callers

nothing calls this directly

Calls 11

ExceptionClass · 0.70
getFunction · 0.50
onExceptionMethod · 0.45
resetMethod · 0.45
cloneMethod · 0.45
finishMethod · 0.45
getTotalsBlockMethod · 0.45
emptyMethod · 0.45
emplaceMethod · 0.45
getExtremesBlockMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected