Loading newbrt/roll.c +10 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,10 @@ toku_commit_fdelete (u_int8_t file_was_open, r = 0; goto done; } assert(r == 0); // must still be open (toku_brt_remove_on_commit() incremented refcount) // file must be open now if it was open when the fdelete was logged, // because the txn that created it opened it and noted it. // XXX this does not look true "must still be open (toku_brt_remove_on_commit() incremented refcount)" assert(r == 0); { (void)toku_cachefile_get_and_pin_fd(cf); assert(!toku_cachefile_is_dev_null_unlocked(cf)); Loading Loading @@ -111,6 +114,9 @@ toku_rollback_fcreate (FILENUM filenum, r = 0; goto done; } // file must be open, because the txn that created it opened it and // noted it, so another client trying to close it would force it // to become a zombie. assert(r == 0); { (void)toku_cachefile_get_and_pin_fd(cf); Loading Loading @@ -571,6 +577,9 @@ toku_rollback_change_fdescriptor(FILENUM filenum, r = 0; goto done; } // file must be open, because the txn that created it opened it and // noted it, so another client trying to close it would force it // to become a zombie. assert(r==0); fd = toku_cachefile_get_and_pin_fd(cf); Loading src/ydb.c +9 −0 Original line number Diff line number Diff line Loading @@ -2759,12 +2759,21 @@ toku_env_dbremove(DB_ENV * env, DB_TXN *txn, const char *fname, const char *dbna r = toku_db_del(env->i->directory, child, &dname_dbt, DB_DELETE_ANY, TRUE); if (r == 0) { if (using_txns) { // this writes an fdelete to the transaction's rollback log. // it is removed if the child txn aborts after any error case below r = toku_brt_remove_on_commit(db_txn_struct_i(child)->tokutxn, &iname_dbt); assert_zero(r); //Now that we have a writelock on dname, verify that there are still no handles open. (to prevent race conditions) if (r==0 && env_is_db_with_dname_open(env, dname)) r = toku_ydb_do_error(env, EINVAL, "Cannot remove dictionary with an open handle.\n"); if (r==0) { // we know a live db handle does not exist. // // if there exists a zombie, make sure that it is due to // checkpoint by trying to get a table lock. we can't // remove a db that live txns reference, but it's okay // to deal with the fact that its pinned for checkpoint // further down the stack. DB* zombie = env_get_zombie_db_with_dname(env, dname); if (zombie) r = toku_db_pre_acquire_table_lock(zombie, child, TRUE); Loading Loading
newbrt/roll.c +10 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,10 @@ toku_commit_fdelete (u_int8_t file_was_open, r = 0; goto done; } assert(r == 0); // must still be open (toku_brt_remove_on_commit() incremented refcount) // file must be open now if it was open when the fdelete was logged, // because the txn that created it opened it and noted it. // XXX this does not look true "must still be open (toku_brt_remove_on_commit() incremented refcount)" assert(r == 0); { (void)toku_cachefile_get_and_pin_fd(cf); assert(!toku_cachefile_is_dev_null_unlocked(cf)); Loading Loading @@ -111,6 +114,9 @@ toku_rollback_fcreate (FILENUM filenum, r = 0; goto done; } // file must be open, because the txn that created it opened it and // noted it, so another client trying to close it would force it // to become a zombie. assert(r == 0); { (void)toku_cachefile_get_and_pin_fd(cf); Loading Loading @@ -571,6 +577,9 @@ toku_rollback_change_fdescriptor(FILENUM filenum, r = 0; goto done; } // file must be open, because the txn that created it opened it and // noted it, so another client trying to close it would force it // to become a zombie. assert(r==0); fd = toku_cachefile_get_and_pin_fd(cf); Loading
src/ydb.c +9 −0 Original line number Diff line number Diff line Loading @@ -2759,12 +2759,21 @@ toku_env_dbremove(DB_ENV * env, DB_TXN *txn, const char *fname, const char *dbna r = toku_db_del(env->i->directory, child, &dname_dbt, DB_DELETE_ANY, TRUE); if (r == 0) { if (using_txns) { // this writes an fdelete to the transaction's rollback log. // it is removed if the child txn aborts after any error case below r = toku_brt_remove_on_commit(db_txn_struct_i(child)->tokutxn, &iname_dbt); assert_zero(r); //Now that we have a writelock on dname, verify that there are still no handles open. (to prevent race conditions) if (r==0 && env_is_db_with_dname_open(env, dname)) r = toku_ydb_do_error(env, EINVAL, "Cannot remove dictionary with an open handle.\n"); if (r==0) { // we know a live db handle does not exist. // // if there exists a zombie, make sure that it is due to // checkpoint by trying to get a table lock. we can't // remove a db that live txns reference, but it's okay // to deal with the fact that its pinned for checkpoint // further down the stack. DB* zombie = env_get_zombie_db_with_dname(env, dname); if (zombie) r = toku_db_pre_acquire_table_lock(zombie, child, TRUE); Loading