rocksdb icon indicating copy to clipboard operation
rocksdb copied to clipboard

A question about changing Compaction Style for a running cluster.

Open wqshr12345 opened this issue 7 months ago • 1 comments

I have a cluster running multiple RocksDB instances, all of which currently use RocksDB's default compaction strategy—Leveled Compaction. I am considering switching the entire cluster to Universal Compaction but am uncertain about potential compatibility issues. Does the RocksDB official team have any constructive recommendations or best practices for this migration? Thank you for your guidance.

wqshr12345 avatar May 27 '25 04:05 wqshr12345

It is generally safe to switch between level and universal compaction styles. You may see some additional compactions after you switch the compaction style, as the new compaction style reshapes the LSM tree. You should configure a sufficient num_levels so that DB open doesn't fail with error like "db has more levels than options.num_levels". Using a large num_levels (such as 50) should not have performance impact on Level compaction with level_compaction_dynamic_level_bytes=true (default) and universal compaction.

cbi42 avatar May 29 '25 17:05 cbi42