| 534 | |
| 535 | |
| 536 | RemoteQueryExecutor::ReadResult RemoteQueryExecutor::read() |
| 537 | { |
| 538 | if (!sent_query) |
| 539 | { |
| 540 | sendQuery(); |
| 541 | |
| 542 | /// `connections` stays null if sendQuery() was cancelled before sending, |
| 543 | /// so guard the dereference below (as every other use of it does). |
| 544 | { |
| 545 | LockAndBlocker lock(was_cancelled_mutex); |
| 546 | if (was_cancelled) |
| 547 | return ReadResult(Block()); |
| 548 | } |
| 549 | |
| 550 | if (context->getSettingsRef()[Setting::skip_unavailable_shards] && (0 == connections->size())) |
| 551 | return ReadResult(Block()); |
| 552 | } |
| 553 | |
| 554 | while (true) |
| 555 | { |
| 556 | LockAndBlocker lock(was_cancelled_mutex); |
| 557 | if (was_cancelled) |
| 558 | return ReadResult(Block()); |
| 559 | |
| 560 | auto packet = connections->receivePacket(); |
| 561 | auto anything = processPacket(std::move(packet)); |
| 562 | |
| 563 | if (anything.getType() == ReadResult::Type::Data || anything.getType() == ReadResult::Type::ParallelReplicasToken) |
| 564 | return anything; |
| 565 | } |
| 566 | } |
| 567 | |
| 568 | RemoteQueryExecutor::ReadResult RemoteQueryExecutor::readAsync() |
| 569 | { |
no test coverage detected