rocksdb/db/compaction
zczhu 30141461f9 Add basic kRoundRobin compaction policy (#10107)
Summary:
Add `kRoundRobin` as a compaction priority. The implementation is as follows.

- Define a cursor as the smallest Internal key in the successor of the selected file. Add `vector<InternalKey> compact_cursor_` into `VersionStorageInfo` where each element (`InternalKey`) in `compact_cursor_` represents a cursor. In round-robin compaction policy, we just need to select the first file (assuming files are sorted) and also has the smallest InternalKey larger than/equal to the cursor. After a file is chosen, we create a new `Fsize` vector which puts the selected file is placed at the first position in `temp`, the next cursor is then updated as the smallest InternalKey in successor of the selected file (the above logic is implemented in `SortFileByRoundRobin`).
- After a compaction succeeds, typically `InstallCompactionResults()`, we choose the next cursor for the input level and save it to `edit`. When calling `LogAndApply`, we save the next cursor with its level into some local variable and finally apply the change to `vstorage` in `SaveTo` function.
- Cursors are persist pair by pair (<level, InternalKey>) in `EncodeTo` so that they can be reconstructed when reopening. An empty cursor will not be encoded to MANIFEST

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

Test Plan: add unit test (`CompactionPriRoundRobin`) in `compaction_picker_test`, add `kRoundRobin` priority in `CompactionPriTest` from `db_compaction_test`, and add `PersistRoundRobinCompactCursor` in `db_compaction_test`

Reviewed By: ajkr

Differential Revision: D37316037

Pulled By: littlepig2013

fbshipit-source-id: 9f481748190ace416079139044e00df2968fb1ee
2022-06-21 11:56:53 -07:00
..
clipping_iterator.h
clipping_iterator_test.cc Cleanup multiple implementations of VectorIterator (#8901) 2021-10-06 07:48:31 -07:00
compaction.cc Support specifying blob garbage collection parameters when CompactRange() (#10073) 2022-06-01 19:40:26 -07:00
compaction.h Support specifying blob garbage collection parameters when CompactRange() (#10073) 2022-06-01 19:40:26 -07:00
compaction_iteration_stats.h Support readahead during compaction for blob files (#9187) 2021-11-19 17:53:47 -08:00
compaction_iterator.cc Abort in dbg mode after logging (#10183) 2022-06-15 22:00:24 -07:00
compaction_iterator.h Consolidate manual_compaction_paused_ check (#10070) 2022-06-06 18:32:26 -07:00
compaction_iterator_test.cc Consolidate manual_compaction_paused_ check (#10070) 2022-06-06 18:32:26 -07:00
compaction_job.cc Add basic kRoundRobin compaction policy (#10107) 2022-06-21 11:56:53 -07:00
compaction_job.h Consolidate manual_compaction_paused_ check (#10070) 2022-06-06 18:32:26 -07:00
compaction_job_stats_test.cc Remove own ToString() (#9955) 2022-05-06 13:03:58 -07:00
compaction_job_test.cc Add blob source to retrieve blobs in RocksDB (#10198) 2022-06-20 20:58:11 -07:00
compaction_picker.cc Support specifying blob garbage collection parameters when CompactRange() (#10073) 2022-06-01 19:40:26 -07:00
compaction_picker.h Add OpenAndTrimHistory API to support trimming data with specified timestamp (#9410) 2022-03-11 16:13:23 -08:00
compaction_picker_fifo.cc Add OpenAndTrimHistory API to support trimming data with specified timestamp (#9410) 2022-03-11 16:13:23 -08:00
compaction_picker_fifo.h Add OpenAndTrimHistory API to support trimming data with specified timestamp (#9410) 2022-03-11 16:13:23 -08:00
compaction_picker_level.cc Add basic kRoundRobin compaction policy (#10107) 2022-06-21 11:56:53 -07:00
compaction_picker_level.h
compaction_picker_test.cc Add basic kRoundRobin compaction policy (#10107) 2022-06-21 11:56:53 -07:00
compaction_picker_universal.cc Use std::numeric_limits<> (#9954) 2022-05-05 13:08:21 -07:00
compaction_picker_universal.h
compaction_service_test.cc Fix failed VerifySstUniqueIds unittests (#10043) 2022-05-24 09:00:06 -07:00
file_pri.h Try to start TTL earlier with kMinOverlappingRatio is used (#8749) 2021-11-01 14:36:31 -07:00
sst_partitioner.cc Restore Regex support for ObjectLibrary::Register, rename new APIs to allow old one to be deprecated in the future (#9362) 2022-01-11 06:33:48 -08:00