rocksdb/db/compaction
Peter Dillinger 8a36543326 Steps toward preserve/preclude options mutable (#13124)
Summary:
Follow-up to https://github.com/facebook/rocksdb/issues/13114

This change makes the options mutable in testing only through some internal hooks, so that we can keep the easier mechanics and testing of making the options mutable separate from a more interesting and critical fix needed for the options to be *safely* mutable. See https://github.com/facebook/rocksdb/pull/9964/files#r1024449523 for some background on the interesting remaining problem, which we've added a test for here, with the failing piece commented out (because it puts the DB in a failure state): PrecludeLastLevelTest.RangeTombstoneSnapshotMigrateFromLast.

The mechanics of making the options mutable turned out to be smaller than expected because `RegisterRecordSeqnoTimeWorker()` and `RecordSeqnoToTimeMapping()` are already robust to things like frequently switching between preserve/preclude durations e.g. with new and dropped column families, based on work from
 https://github.com/facebook/rocksdb/issues/11920, https://github.com/facebook/rocksdb/issues/11929, and https://github.com/facebook/rocksdb/issues/12253. Mostly, `options_mutex_` prevents races
in applying the options changes, and smart capacity enforcement in `SeqnoToTimeMapping` means it doesn't really matter if the periodic task wakes up too often by being re-scheduled repeatedly.

Functional changes needed other than marking mutable:
* Update periodic task registration (as needed) from SetOptions, with a mapping recorded then also in case it's needed.
* Install SuperVersion(s) with updated mapping when the registration function itself updates the mapping.

Possible follow-up (aside from already mentioned):
* Some FIXME code in RangeTombstoneSnapshotMigrateFromLast is present because Flush does not automatically include a seqno to time mapping entry that puts an upper bound on how new the flushed data is. This has the potential to be a measurable CPU impact so needs to be done carefully.

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

Test Plan:
updated/refactored tests in tiered_compaction_test to parametrically use dynamic configuration changes (or DB restarts) when changing operating parameters such as these.

CheckInternalKeyRange test got some heavier refactoring in preparation for follow-up, and manually verified that the test still fails when relevant `if (!safe_to_penultimate_level) ...` code is disabled.

Reviewed By: jowlyzhang

Differential Revision: D65634146

Pulled By: pdillinger

fbshipit-source-id: 25c9d00fd5b7fd1b408b5f36d58dc48647970528
2024-11-18 19:34:01 -08:00
..
clipping_iterator.h Refactor AddRangeDels() + consider range tombstone during compaction file cutting (#11113) 2023-02-22 12:28:18 -08:00
clipping_iterator_test.cc Print stack traces on frozen tests in CI (#10828) 2022-10-18 00:35:35 -07:00
compaction.cc Add compaction stats for filtered files (#13136) 2024-11-14 10:10:38 -08:00
compaction.h Add compaction stats for filtered files (#13136) 2024-11-14 10:10:38 -08:00
compaction_iteration_stats.h Add initial support for TimedPut API (#12419) 2024-03-14 15:44:55 -07:00
compaction_iterator.cc Add CompactForTieringCollector to support automatically trigger compaction for tiering use case (#12760) 2024-06-18 10:51:29 -07:00
compaction_iterator.h Optimize compaction for standalone range deletion files (#13078) 2024-10-25 09:32:14 -07:00
compaction_iterator_test.cc Add CompactForTieringCollector to support automatically trigger compaction for tiering use case (#12760) 2024-06-18 10:51:29 -07:00
compaction_job.cc Add compaction stats for filtered files (#13136) 2024-11-14 10:10:38 -08:00
compaction_job.h Add compaction stats for filtered files (#13136) 2024-11-14 10:10:38 -08:00
compaction_job_stats_test.cc Replace ScopedArenaIterator with ScopedArenaPtr<InternalIterator> (#12470) 2024-03-22 13:40:42 -07:00
compaction_job_test.cc Record newest_key_time as a table property (#13083) 2024-11-01 10:08:35 -07:00
compaction_outputs.cc Preserve TimedPut on penultimate level until it actually expires (#12543) 2024-04-30 11:16:02 -07:00
compaction_outputs.h Include TableProperties in the CompactionServiceResult (#13089) 2024-10-25 13:13:12 -07:00
compaction_picker.cc Refactoring toward making preserve/preclude options mutable (#13114) 2024-11-04 16:15:10 -08:00
compaction_picker.h Refactoring toward making preserve/preclude options mutable (#13114) 2024-11-04 16:15:10 -08:00
compaction_picker_fifo.cc Remove early return when scanning files for temperature change compaction (#13112) 2024-11-05 09:12:39 -08:00
compaction_picker_fifo.h Optimize compaction for standalone range deletion files (#13078) 2024-10-25 09:32:14 -07:00
compaction_picker_level.cc Refactoring toward making preserve/preclude options mutable (#13114) 2024-11-04 16:15:10 -08:00
compaction_picker_level.h Optimize compaction for standalone range deletion files (#13078) 2024-10-25 09:32:14 -07:00
compaction_picker_test.cc Refactoring toward making preserve/preclude options mutable (#13114) 2024-11-04 16:15:10 -08:00
compaction_picker_universal.cc Refactoring toward making preserve/preclude options mutable (#13114) 2024-11-04 16:15:10 -08:00
compaction_picker_universal.h Optimize compaction for standalone range deletion files (#13078) 2024-10-25 09:32:14 -07:00
compaction_service_job.cc TableProperties Serialization Follow Ups (#13095) 2024-10-31 11:13:53 -07:00
compaction_service_test.cc Rely on PurgeObsoleteFiles Only for Options file clean up when remote compaction is enabled (#13139) 2024-11-15 14:21:32 -08:00
compaction_state.cc Fix Compaction Stats (#13071) 2024-10-16 19:20:37 -07:00
compaction_state.h Tiered Compaction: per key placement support (#9964) 2022-07-13 20:54:49 -07:00
file_pri.h Avoid shifting component too large error in FileTtlBooster (#11673) 2023-08-04 14:29:50 -07:00
sst_partitioner.cc Remove FactoryFunc from LoadXXXObject (#11203) 2023-02-17 12:54:07 -08:00
subcompaction_state.cc Fix and test for leaks of open SST files (#13117) 2024-11-08 10:54:43 -08:00
subcompaction_state.h Fix Compaction Stats (#13071) 2024-10-16 19:20:37 -07:00
tiered_compaction_test.cc Steps toward preserve/preclude options mutable (#13124) 2024-11-18 19:34:01 -08:00