facebook / mysql-5.6

Facebook's branch of the Oracle MySQL database. This includes MyRocks.

Home Page:http://myrocks.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pfs.log_status query hangs if rocksdb_file_deletions were not disabled beforehand

laurynas-biveinis opened this issue · comments

If MyRocks is running, and rocksdb_file_deletions was not set, i.e. is zero, then any pfs.log_status query hangs.

Looking into MyRocks and RocksDB code it is caused by

  1. rocksdb_lock_hton_log gets RocksDB log_write_mutex_ locked, by design
  2. GetSortedWALFiles finds that file deletions have not been disabled, thus it disables them by itself, collects the result set
  3. GetSortedWALFiles calls EnableFileDeletions
  4. Which calls FindObsoleteFiles, which attempts to lock log_write_mutex_ again. Partial stacktrace:
...
    frame #5: 0x00000001040fb9bc mysqld`rocksdb::InstrumentedMutex::Lock(this=0x000000011c8d6c08) at instrumented_mutex.cc:31:3
    frame #6: 0x0000000103bedc24 mysqld`rocksdb::DBImpl::FindObsoleteFiles(this=0x000000011c8d6200, job_context=0x0000000171273cb0, force=true, no_full_scan=false) at db_impl_files.cc:274:20
    frame #7: 0x0000000103bed0f4 mysqld`rocksdb::DBImpl::EnableFileDeletions(this=0x000000011c8d6200, force=false) at db_impl_files.cc:79:7
    frame #8: 0x0000000103aa90e8 mysqld`rocksdb::DBImpl::GetSortedWalFiles(this=0x000000011c8d6200, files=size=0) at db_filesnapshot.cc:156:17
    frame #9: 0x000000010467bdbc mysqld`rocksdb::StackableDB::GetSortedWalFiles(this=0x000000011956bf10, files=size=0) at stackable_db.h:462:17
    frame #10: 0x00000001047c5b0c mysqld`myrocks::rocksdb_collect_hton_log_info((null)=0x0000000119556d60, json=0x00000001712745e0) at ha_rocksdb.cc:6614:23
    frame #11: 0x000000010085b5dc mysqld`Log_resource_hton_wrapper::collect_info(this=0x0000600002642060) at log_resource.cc:119:14
    frame #12: 0x00000001037d2ed8 mysqld`table_log_status::make_row(this=0x00006000013615c0) at table_log_status.cc:265:18
...

This appears to be introduced in RocksDB 7.4.0 with facebook/rocksdb@1e9bf25.

Percona Server is not yet affected, because they are on RocksDB 7.0.1. I assume that MariaDB is not affected at all because GetSortedWALFiles is not called.

It looks like a RocksDB fix is being developed at facebook/rocksdb#10953

A new proposed fix: facebook/rocksdb#11020