• A
    added public api to schedule flush/compaction, code to prevent race with db::open · e8180f99
    Alex Yang 提交于
    Summary:
    Fixes T8781168.
    
    Added a new function EnableAutoCompactions in db.h to be publicly
    avialable.  This allows compaction to be re-enabled after disabling it via
    SetOptions
    
    Refactored code to set the dbptr earlier on in TransactionDB::Open and DB::Open
    Temporarily disable auto_compaction in TransactionDB::Open until dbptr is set to
    prevent race condition.
    
    Test Plan:
    Ran make all check
    
    verified fix on myrocks side:
    was able to reproduce the seg fault with
    ../tools/mysqltest.sh --mem --force rocksdb.drop_table
    
    method was to manually sleep the thread after DB::Open but before TransactionDB ptr was
    assigned in transaction_db_impl.cc:
      DB::Open(db_options, dbname, column_families_copy, handles, &db);
      clock_t goal = (60000 * 10) + clock();
      while (goal > clock());
      ...dbptr(aka rdb) gets assigned below
    
    verified my changes fixed the issue.
    
    Also added unit test 'ToggleAutoCompaction' in transaction_test.cc
    
    Reviewers: hermanlee4, anthony
    
    Reviewed By: anthony
    
    Subscribers: alex, dhruba
    
    Differential Revision: https://reviews.facebook.net/D51147
    e8180f99
db_impl.cc 186.0 KB