rocksdb/file
Xingbo Wang 11a259a5f0 Support GetFileSize API in FSRandomAccessFile (#13676)
Summary:
Add file size validation in ReadFooterFromFile function.
    Deprecate skip_checking_sst_file_sizes_on_db_open option.
    This change is used to address this issue
    https://github.com/facebook/rocksdb/issues/13619
    It supports file size validation in ReadFooterFromFile. In favor of this
    change, CheckConsistency function and
    skip_checking_sst_file_sizes_on_db_open flag are deprecated.

    The CheckConsistency function checks each file size matches what was
    recorded in manifest during DB open. Meantime, ReadFooterFromFile was
    called for each file in LoadTables function. Since ReadFooterFromFile
    always validates file size, the CheckConsistency is redundant.

    In addtion, CheckConsistency is executed in a single thread. This could
    slow down DB open when a network file system is used. Therefore, the
    flag skip_checking_sst_file_sizes_on_db_open was added to skip this
    check. After this change, ReadFooterFromFile was executed in parallel
    through multiple threads. Therefore, the concern of DB open slowness is
    eliminated, and the flag could be deprecated.

    When paranoid check flag is set to true, corrupted file will fail to open the DB.
    When paranoid check flag is set to false, DB will still be able to open, the
    healthy ones can be accessed, while the corrupted ones not.

    There is 2 slight concerns of this change.

    *If max_open_files is set with smaller value, engine will not open all
    the files during DB open. This means if there is a corruption on file
    size, it will not be detected during DB open, but rather at a later
    time. Since the default is -1, which means open all the files, and it is
    rarely overridden and a lot of new features rely on it to be -1, the
    risk is very low.

    *If FIFO compaction is used, engine could fail to open DB unnecessarily
    on the corrupted files that would never be used again. However, this is
    a very rare case as well. The error could still be ignored by setting
    paranoid_checks operationally. The risk is very low.

    To remain backward compatibility. The public facing flag was kept and
    marked as no-op internally. Another change is required to fully remove
    the flag.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/13676

Test Plan:
make check
    A new unit test was added to validate file size check API works as
    expected.

Reviewed By: pdillinger

Differential Revision: D76168033

Pulled By: xingbowang

fbshipit-source-id: 8ceacf39bcfe02ff7aa289868c341366ee9f3a8e
2025-07-09 10:40:28 -07:00
..
delete_scheduler.cc Reduce db stress noise (#13447) 2025-03-12 01:13:40 -07:00
delete_scheduler.h Standardize on clang-format version 18 (#13233) 2024-12-19 10:58:40 -08:00
delete_scheduler_test.cc Standardize on clang-format version 18 (#13233) 2024-12-19 10:58:40 -08:00
file_prefetch_buffer.cc Add compaction explicit prefetch stats (#13520) 2025-04-14 12:08:38 -07:00
file_prefetch_buffer.h Add compaction explicit prefetch stats (#13520) 2025-04-14 12:08:38 -07:00
file_util.cc propagate request_id from app -> Rocks -> FS (#13616) 2025-05-16 21:25:50 -07:00
file_util.h propagate request_id from app -> Rocks -> FS (#13616) 2025-05-16 21:25:50 -07:00
filename.cc Options for file temperature for more files (#12957) 2024-08-23 19:49:25 -07:00
filename.h Options for file temperature for more files (#12957) 2024-08-23 19:49:25 -07:00
line_file_reader.cc Support read rate-limiting in SequentialFileReader (#9973) 2022-05-24 10:28:57 -07:00
line_file_reader.h Support read rate-limiting in SequentialFileReader (#9973) 2022-05-24 10:28:57 -07:00
prefetch_test.cc Add compaction explicit prefetch stats (#13520) 2025-04-14 12:08:38 -07:00
random_access_file_reader.cc propagate request_id from app -> Rocks -> FS (#13616) 2025-05-16 21:25:50 -07:00
random_access_file_reader.h propagate request_id from app -> Rocks -> FS (#13616) 2025-05-16 21:25:50 -07:00
random_access_file_reader_test.cc propagate request_id from app -> Rocks -> FS (#13616) 2025-05-16 21:25:50 -07:00
read_write_util.cc Run Clang format on file folder (#10860) 2022-10-24 18:34:52 -07:00
read_write_util.h Remove unnecessary, confusing 'extern' (#12300) 2024-01-29 10:38:08 -08:00
readahead_file_info.h Reuse internal auto readhead_size at each Level (expect L0) for Iterations (#9056) 2021-11-10 16:20:04 -08:00
readahead_raf.cc Support GetFileSize API in FSRandomAccessFile (#13676) 2025-07-09 10:40:28 -07:00
readahead_raf.h Make StringEnv, StringSink, StringSource use FS classes (#7786) 2021-01-04 16:01:01 -08:00
sequence_file_reader.cc Retry DB::Open upon a corruption detected while reading the MANIFEST (#12518) 2024-04-18 17:36:33 -07:00
sequence_file_reader.h Retry DB::Open upon a corruption detected while reading the MANIFEST (#12518) 2024-04-18 17:36:33 -07:00
sst_file_manager_impl.cc Clean up some CFOptions code hygiene, fix SetOptions() bug (#13294) 2025-01-15 13:11:40 -08:00
sst_file_manager_impl.h Remove stats_ field from SstFileManagerImpl (#13757) 2025-07-08 15:54:42 -07:00
writable_file_writer.cc Fix overflow of data_size in WritableFileWriter::WriteBufferedWithChecksum (#13641) 2025-06-10 19:03:53 -07:00
writable_file_writer.h Handle injected write error after successful WAL write in crash test + misc (#12838) 2024-07-29 13:51:49 -07:00