facebook / mysql-5.6

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

Fix issues 1200 and 1295, add rocksdb_compact_lzero_now global variable #1309

Open mdcallag opened 1 year ago

mdcallag commented 1 year ago

This fixes issue 1295 and has a workaround for issue 1200. https://github.com/facebook/mysql-5.6/issues/1200 https://github.com/facebook/mysql-5.6/issues/1295

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.

Other changes:

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

But these variables always show the value 0 (OFF, false). Their value doesn't change.

mdcallag commented 1 year ago

I ran the rocksdb, rocksdb_rpl and rocksdb_sys_vars suites

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.

mdcallag commented 1 month ago

AFAIK the fix has been merged