| 611 | } |
| 612 | |
| 613 | void StorageDistributedDirectoryMonitor::processFile(const std::string & file_path) |
| 614 | { |
| 615 | Stopwatch watch; |
| 616 | auto timeouts = ConnectionTimeouts::getTCPTimeoutsWithFailover(storage.getContext()->getSettingsRef()); |
| 617 | |
| 618 | try |
| 619 | { |
| 620 | CurrentMetrics::Increment metric_increment{CurrentMetrics::DistributedSend}; |
| 621 | |
| 622 | ReadBufferFromFile in(file_path); |
| 623 | const auto & distributed_header = readDistributedHeader(in, log); |
| 624 | |
| 625 | LOG_DEBUG(log, "Started processing `{}` ({} rows, {} bytes)", file_path, |
| 626 | formatReadableQuantity(distributed_header.rows), |
| 627 | formatReadableSizeWithBinarySuffix(distributed_header.bytes)); |
| 628 | |
| 629 | auto connection = pool->get(timeouts, &distributed_header.insert_settings); |
| 630 | RemoteBlockOutputStream remote{*connection, timeouts, |
| 631 | distributed_header.insert_query, |
| 632 | distributed_header.insert_settings, |
| 633 | distributed_header.client_info, |
| 634 | storage.getContext()}; |
| 635 | remote.writePrefix(); |
| 636 | bool compression_expected = connection->getCompression() == Protocol::Compression::Enable; |
| 637 | writeRemoteConvert(distributed_header, remote, compression_expected, in, log); |
| 638 | remote.writeSuffix(); |
| 639 | } |
| 640 | catch (Exception & e) |
| 641 | { |
| 642 | e.addMessage(fmt::format("While sending {}", file_path)); |
| 643 | maybeMarkAsBroken(file_path, e); |
| 644 | throw; |
| 645 | } |
| 646 | |
| 647 | auto dir_sync_guard = getDirectorySyncGuard(dir_fsync, disk, relative_path); |
| 648 | markAsSend(file_path); |
| 649 | LOG_TRACE(log, "Finished processing `{}` (took {} ms)", file_path, watch.elapsedMilliseconds()); |
| 650 | } |
| 651 | |
| 652 | struct StorageDistributedDirectoryMonitor::BatchHeader |
| 653 | { |
nothing calls this directly
no test coverage detected