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

Method readDiskCheckerMagicNumber

src/Disks/DiskLocal.cpp:670–688  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

668}
669
670std::optional<UInt32> DiskLocal::readDiskCheckerMagicNumber() const noexcept
671try
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}
684catch (...)
685{
686 tryLogCurrentException(logger, fmt::format("Cannot read correct disk check magic number from from {}{}", disk_path, disk_checker_path));
687 return {};
688}
689
690bool DiskLocal::canRead() const noexcept
691try

Callers

nothing calls this directly

Calls 5

readIntBinaryFunction · 0.85
readFileFunction · 0.50
tryLogCurrentExceptionFunction · 0.50
formatFunction · 0.50
eofMethod · 0.45

Tested by

no test coverage detected