facebook / rocksdb

A library that provides an embeddable, persistent key-value store for fast storage.
http://rocksdb.org
GNU General Public License v2.0
27.83k stars 6.2k forks source link

Questions about rocksdb compaction #12817

Closed wanglinke521 closed 5 days ago

wanglinke521 commented 1 week ago

Note: Please use Issues only for bug reports. For questions, discussions, feature requests, etc. post to dev group: https://groups.google.com/forum/#!forum/rocksdb or https://www.facebook.com/groups/rocksdb.dev

When I delete the sst file in L0-L3 layers of rocksdb, will the sst file in L4 layer return to L0-L3 or go to L5 after compaction? Can you help answer my question? Thank you very much.

ajkr commented 5 days ago

Automatic compaction merges files gradually to deeper levels, i.e., L4+. There are some manual compaction settings that can write files to shallower empty levels (L1-L3), like CompactRange() with CompactRangeOptions::change_level set to true.