| 668 | } |
| 669 | |
| 670 | std::optional<UInt32> DiskLocal::readDiskCheckerMagicNumber() const noexcept |
| 671 | try |
| 672 | { |
| 673 | ReadSettings read_settings; |
| 674 | /// Proper disk read checking requires direct io |
| 675 | read_settings.local_fs_settings.direct_io_threshold = 1; |
| 676 | auto buf = readFile(disk_checker_path, read_settings, {}); |
| 677 | UInt32 magic_number = 0; |
| 678 | readIntBinary(magic_number, *buf); |
| 679 | if (buf->eof()) |
| 680 | return magic_number; |
| 681 | LOG_WARNING(logger, "The size of disk check magic number is more than 4 bytes. Mark it as read failure"); |
| 682 | return {}; |
| 683 | } |
| 684 | catch (...) |
| 685 | { |
| 686 | tryLogCurrentException(logger, fmt::format("Cannot read correct disk check magic number from from {}{}", disk_path, disk_checker_path)); |
| 687 | return {}; |
| 688 | } |
| 689 | |
| 690 | bool DiskLocal::canRead() const noexcept |
| 691 | try |
nothing calls this directly
no test coverage detected