rocksdb/utilities/blob_db
Yu Zhang 39a4ff2cab Track full_history_ts_low per SuperVersion (#11784)
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
2023-09-13 16:34:18 -07:00
..
blob_compaction_filter.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
blob_compaction_filter.h Change internal headers with duplicate names (#11408) 2023-05-17 11:27:09 -07:00
blob_db.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
blob_db.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
blob_db_gc_stats.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
blob_db_impl.cc Track full_history_ts_low per SuperVersion (#11784) 2023-09-13 16:34:18 -07:00
blob_db_impl.h Group rocksdb.sst.read.micros stat by different user read IOActivity + misc (#11444) 2023-08-08 17:26:50 -07:00
blob_db_impl_filesnapshot.cc Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
blob_db_iterator.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
blob_db_listener.h Add missing status check when compiling with ASSERT_STATUS_CHECKED=1 (#11686) 2023-08-09 15:46:44 -07:00
blob_db_test.cc Deflake some old BlobDB test cases (#11417) 2023-04-28 14:07:45 -07:00
blob_dump_tool.cc Group rocksdb.sst.read.micros stat by different user read IOActivity + misc (#11444) 2023-08-08 17:26:50 -07:00
blob_dump_tool.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00
blob_file.cc Group rocksdb.sst.read.micros stat by different user read IOActivity + misc (#11444) 2023-08-08 17:26:50 -07:00
blob_file.h Remove RocksDB LITE (#11147) 2023-01-27 13:14:19 -08:00