rocksdb/file
Peter Dillinger 25a0d0ca30 Fix block checksum for >=4GB, refactor (#6978)
Summary:
Although RocksDB falls over in various other ways with KVs
around 4GB or more, this change fixes how XXH32 and XXH64 were being
called by the block checksum code to support >= 4GB in case that should
ever happen, or the code copied for other uses.

This change is not a schema compatibility issue because the checksum
verification code would checksum the first (block_size + 1) mod 2^32
bytes while the checksum construction code would checksum the first
block_size mod 2^32 plus the compression type byte, meaning the
XXH32/64 checksums for >=4GB block would not match about 255/256 times.

While touching this code, I refactored to consolidate redundant
implementations, improving diagnostics and performance tracking in some
cases. Also used less confusing language in those diagnostics.

Makes https://github.com/facebook/rocksdb/issues/6875 obsolete.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6978

Test Plan:
I was able to write a test for this using an SST file writer
and VerifyChecksum in a reader. The test fails before the fix, though
I'm leaving the test disabled because I don't think it's worth the
expense of running regularly.

Reviewed By: gg814

Differential Revision: D22143260

Pulled By: pdillinger

fbshipit-source-id: 982993d16134e8c50bea2269047f901c1783726e
2020-06-19 16:18:24 -07:00
..
delete_scheduler_test.cc Add logs and stats in DeleteScheduler (#6927) 2020-06-05 09:43:04 -07:00
delete_scheduler.cc Add logs and stats in DeleteScheduler (#6927) 2020-06-05 09:43:04 -07:00
delete_scheduler.h Add logs and stats in DeleteScheduler (#6927) 2020-06-05 09:43:04 -07:00
file_prefetch_buffer.cc Reduce dependency on gtest dependency in release code (#6907) 2020-06-02 12:11:24 -07:00
file_prefetch_buffer.h Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
file_util.cc Ingest SST files with checksum information (#6891) 2020-06-11 14:27:36 -07:00
file_util.h Ingest SST files with checksum information (#6891) 2020-06-11 14:27:36 -07:00
filename.cc Find/purge obsolete blob files (#6807) 2020-05-07 09:32:51 -07:00
filename.h Find/purge obsolete blob files (#6807) 2020-05-07 09:32:51 -07:00
random_access_file_reader_test.cc Some fixes for gcc 4.8 and add to Travis (#6915) 2020-06-03 11:39:25 -07:00
random_access_file_reader.cc sst_dump to reduce number of file reads (#6836) 2020-05-12 18:23:33 -07:00
random_access_file_reader.h Fix block checksum for >=4GB, refactor (#6978) 2020-06-19 16:18:24 -07:00
read_write_util.cc Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
read_write_util.h Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
readahead_raf.cc Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
readahead_raf.h Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
sequence_file_reader.cc Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
sequence_file_reader.h Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
sst_file_manager_impl.cc Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) 2020-02-20 12:09:57 -08:00
sst_file_manager_impl.h Add logs and stats in DeleteScheduler (#6927) 2020-06-05 09:43:04 -07:00
writable_file_writer.cc Remove unnecessary inclusion of version_edit.h in env (#6952) 2020-06-07 21:56:55 -07:00
writable_file_writer.h Clean up some code related to file checksums (#6861) 2020-05-21 08:12:51 -07:00