mirror of https://github.com/facebook/rocksdb.git
39a4ff2cab
Summary: As discussed in https://github.com/facebook/rocksdb/issues/11730 , this PR tracks the effective `full_history_ts_low` per SuperVersion and update existing sanity checks for `ReadOptions.timestamp >= full_history_ts_low` to use this per SuperVersion `full_history_ts_low` instead. This also means the check is moved to happen after acquiring SuperVersion. There are two motivations for this: 1) Each time `full_history_ts_low` really come into effect to collapse history, a new SuperVersion is always installed, because it would involve either a Flush or Compaction, both of which change the LSM tree shape. We can take advantage of this to ensure that as long as this sanity check is passed, even if `full_history_ts_low` can be concurrently increased and collapse some history above the requested `ReadOptions.timestamp`, a read request won’t have visibility to that part of history through this SuperVersion that it already acquired. 2) the existing sanity check uses `ColumnFamilyData::GetFullHistoryTsLow` without locking the db mutex, which is the mutex all `IncreaseFullHistoryTsLow` operation is using when mutating this field. So there is a race condition. This also solve the race condition on the read path. Pull Request resolved: https://github.com/facebook/rocksdb/pull/11784 Test Plan: `make all check` // Checks success scenario really provide the read consistency attribute as mentioned above. `./db_with_timestamp_basic_test --gtest_filter=*FullHistoryTsLowSanityCheckPassReadIsConsistent*` // Checks failure scenario cleans up SuperVersion properly. `./db_with_timestamp_basic_test --gtest_filter=*FullHistoryTsLowSanityCheckFail*` `./db_secondary_test --gtest_filter=*FullHistoryTsLowSanityCheckFail*` `./db_readonly_with_timestamp_test --gtest_filter=*FullHistoryTsLowSanitchCheckFail*` Reviewed By: ltamasi Differential Revision: D48894795 Pulled By: jowlyzhang fbshipit-source-id: 1f801fe8e1bc8e63ca76c03cbdbd0974e5ff5bf6 |
||
---|---|---|
.. | ||
blob_constants.h | ||
blob_contents.cc | ||
blob_contents.h | ||
blob_counting_iterator.h | ||
blob_counting_iterator_test.cc | ||
blob_fetcher.cc | ||
blob_fetcher.h | ||
blob_file_addition.cc | ||
blob_file_addition.h | ||
blob_file_addition_test.cc | ||
blob_file_builder.cc | ||
blob_file_builder.h | ||
blob_file_builder_test.cc | ||
blob_file_cache.cc | ||
blob_file_cache.h | ||
blob_file_cache_test.cc | ||
blob_file_completion_callback.h | ||
blob_file_garbage.cc | ||
blob_file_garbage.h | ||
blob_file_garbage_test.cc | ||
blob_file_meta.cc | ||
blob_file_meta.h | ||
blob_file_reader.cc | ||
blob_file_reader.h | ||
blob_file_reader_test.cc | ||
blob_garbage_meter.cc | ||
blob_garbage_meter.h | ||
blob_garbage_meter_test.cc | ||
blob_index.h | ||
blob_log_format.cc | ||
blob_log_format.h | ||
blob_log_sequential_reader.cc | ||
blob_log_sequential_reader.h | ||
blob_log_writer.cc | ||
blob_log_writer.h | ||
blob_read_request.h | ||
blob_source.cc | ||
blob_source.h | ||
blob_source_test.cc | ||
db_blob_basic_test.cc | ||
db_blob_compaction_test.cc | ||
db_blob_corruption_test.cc | ||
db_blob_index_test.cc | ||
prefetch_buffer_collection.cc | ||
prefetch_buffer_collection.h |