docs: add recovery mode for leveled compaction (#86)

Signed-off-by: Alex Chi <iskyzh@gmail.com>
This commit is contained in:
Alex Chi Z
2024-07-02 20:36:07 -04:00
committed by GitHub
parent 77e15efad4
commit dd333ca5a7
3 changed files with 28 additions and 20 deletions

View File

@@ -395,16 +395,18 @@ impl LsmStorageInner {
next_sst_id += 1;
// Sort SSTs on each level
for (_id, ssts) in &mut state.levels {
ssts.sort_by(|x, y| {
state
.sstables
.get(x)
.unwrap()
.first_key()
.cmp(state.sstables.get(y).unwrap().first_key())
})
// Sort SSTs on each level (only for leveled compaction)
if let CompactionController::Leveled(_) = &compaction_controller {
for (_id, ssts) in &mut state.levels {
ssts.sort_by(|x, y| {
state
.sstables
.get(x)
.unwrap()
.first_key()
.cmp(state.sstables.get(y).unwrap().first_key())
})
}
}
// recover memtables