facebook / mysql-5.6

Facebook's branch of the Oracle MySQL database. This includes MyRocks.
http://myrocks.io
Other
2.47k stars 712 forks source link

Add rocksdb_compact_lzero_now global variable #1332

Closed mdcallag closed 1 year ago

mdcallag commented 1 year ago

This fixes issues 1200 and 1295 for 5.6.35 similar to how the were fixed for 8.0.28 by: https://github.com/facebook/mysql-5.6/commit/3ba4f39d4ef9a7389a92938997ae02de953de718

The fix for issue 1295 is to get the value of the base level from RocksDB rather than assuming that L0 compacts into L1 because L1 might not be the base level when dynamic leveled compaction is used -- in that case the base level can be Ln where n > 1 because L1 isn't needed yet.

There are two workarounds for issue 1200. The hacky one is to sleep for 1 second between requesting memtable flush and L0 -> base_level compaction.

The alternative is to add a new global variable, rocksdb_compact_lzero_now, that when set will request L0 -> base_level compaction. This allows a client to first set rocksdb_force_flush_memtable_now, wait for that to finish, then set rocksdb_compact_lzero_now.

Note: these variables are triggers, an action is taken when this is done: set global var = ON | true | 1

facebook-github-bot commented 1 year ago

@hermanlee has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 1 year ago

This pull request has been merged in facebook/mysql-5.6@76145e1afee877d5e1d50449755d47dce250da14.