Commit f3455ce7 authored by Yoni Fogel's avatar Yoni Fogel

closes #5108 Remove finalize_callback (poisons lock tree)

It's unnecessary since we never reuse filenames anyway.

git-svn-id: file:///svn/toku/tokudb@46191 c7de825b-a66e-492c-adef-691d508d4ae1
parent e65963f3
......@@ -1314,28 +1314,6 @@ toku_logger_get_next_lsn(TOKULOGGER logger) {
return logger->lsn;
}
//////////////////////////////////////////////////////////////////////////////////////
// remove_finalize_callback is set when environment is created so that when
// a file removal is committed (or a file creation is aborted), the brt
// layer can call the ydb-layer callback to clean up the lock tree.
// called from toku_env_open()
void
toku_logger_set_remove_finalize_callback(TOKULOGGER logger, void (*funcp)(DICTIONARY_ID, void *), void * extra) {
logger->remove_finalize_callback = funcp;
logger->remove_finalize_callback_extra = extra;
}
// called when a transaction that deleted a file is committed, or
// when a transaction that created a file is aborted.
// During recovery, there is no ydb layer, so no callback exists.
void
toku_logger_call_remove_finalize_callback(TOKULOGGER logger, DICTIONARY_ID dict_id) {
if (logger->remove_finalize_callback)
logger->remove_finalize_callback(dict_id, logger->remove_finalize_callback_extra);
}
///////////////////////////////////////////////////////////////////////////////////
// Engine status
//
......
......@@ -104,8 +104,6 @@ TOKUTXN toku_logger_txn_parent (TOKUTXN txn);
void toku_logger_note_checkpoint(TOKULOGGER logger, LSN lsn);
LSN toku_logger_get_next_lsn(TOKULOGGER logger);
void toku_logger_set_remove_finalize_callback(TOKULOGGER logger, void (*funcp)(DICTIONARY_ID, void *), void * extra);
void toku_logger_call_remove_finalize_callback(TOKULOGGER logger, DICTIONARY_ID dict_id);
int toku_logger_make_space_in_inbuf (TOKULOGGER logger, int n_bytes_needed);
......
......@@ -45,16 +45,6 @@ toku_commit_fdelete (FILENUM filenum,
}
assert_zero(r);
// TODO(yoni): this callback may not be necessary. it seems to remove
// the locktree from the environment's ltm, but that shouldn't
// be necessary since that happens once this txn commits
// (which is after this function ends, essentially)
FT ft;
CAST_FROM_VOIDP(ft, toku_cachefile_get_userdata(cf));
DICTIONARY_ID dict_id;
dict_id = ft->dict_id;
toku_logger_call_remove_finalize_callback(txn->logger, dict_id);
// bug fix for #4718
// bug was introduced in with fix for #3590
// Before Maxwell (and fix for #3590),
......@@ -123,16 +113,6 @@ toku_rollback_fcreate (FILENUM filenum,
}
assert_zero(r);
// TODO(yoni): this callback may not be necessary. it seems to remove
// the locktree from the environment's ltm, but that shouldn't
// be necessary since that happens once this txn commits
// (which is after this function ends, essentially)
FT ft;
CAST_FROM_VOIDP(ft, toku_cachefile_get_userdata(cf));
DICTIONARY_ID dict_id;
dict_id = ft->dict_id;
toku_logger_call_remove_finalize_callback(txn->logger, dict_id);
// Mark the cachefile as unlink on close. There are two ways for close
// to be eventually called on the cachefile:
//
......
......@@ -1313,18 +1313,6 @@ cleanup:
return r;
}
void
toku_ltm_invalidate_lt(toku_ltm* mgr, DICTIONARY_ID dict_id) {
assert(mgr && dict_id.dictid != DICTIONARY_ID_NONE.dictid);
toku_lt_map* map = NULL;
ltm_mutex_lock(mgr);
map = toku_idlth_find(mgr->idlth, dict_id);
if (map) {
toku_idlth_delete(mgr->idlth, dict_id);
}
ltm_mutex_unlock(mgr);
}
static inline void
lt_set_dict_id(toku_lock_tree* lt, DICTIONARY_ID dict_id) {
assert(lt && dict_id.dictid != DICTIONARY_ID_NONE.dictid);
......
......@@ -127,8 +127,6 @@ int toku_ltm_get_lt(toku_ltm* mgr, toku_lock_tree** ptree, DICTIONARY_ID dict_id
toku_dbt_cmp compare_fun, toku_lt_on_create_cb on_create_callback, void *on_create_extra,
toku_lt_on_close_cb on_close_callback);
void toku_ltm_invalidate_lt(toku_ltm* mgr, DICTIONARY_ID dict_id);
extern const DBT* const toku_lt_infinity; /**< Special value denoting +infty */
extern const DBT* const toku_lt_neg_infinity; /**< Special value denoting -infty */
......
......@@ -60,11 +60,10 @@ static void run_test(void) {
setup_tree(3, dict_id3);
assert(lt[0] == lt[3]);
toku_ltm_invalidate_lt(ltm, dict_id1);
setup_tree(4, dict_id1);
assert(lt[0] != lt[4]);
assert(lt[0] == lt[4]);
setup_tree(5, dict_id1);
assert(lt[0] != lt[5]);
assert(lt[0] == lt[5]);
assert(lt[4] == lt[5]);
close_ltm();
......
......@@ -401,8 +401,6 @@ needs_recovery (DB_ENV *env) {
static int toku_env_txn_checkpoint(DB_ENV * env, uint32_t kbyte, uint32_t min, uint32_t flags);
static void finalize_file_removal(DICTIONARY_ID dict_id, void * extra);
// Instruct db to use the default (built-in) key comparison function
// by setting the flag bits in the db and brt structs
static int
......@@ -939,7 +937,6 @@ env_open(DB_ENV * env, const char *home, uint32_t flags, int mode) {
// if this is a newborn env or if this is an upgrade, then create a brand new rollback file
assert (using_txns);
toku_logger_set_cachetable(env->i->logger, env->i->cachetable);
toku_logger_set_remove_finalize_callback(env->i->logger, finalize_file_removal, env->i->ltm);
if (!toku_logger_rollback_is_open(env->i->logger)) {
bool create_new_rollback_file = newenv | upgrade_in_progress;
r = toku_logger_open_rollback(env->i->logger, env->i->cachetable, create_new_rollback_file);
......@@ -2391,17 +2388,6 @@ env_dbremove_subdb(DB_ENV * env, DB_TXN * txn, const char *fname, const char *db
}
//Called during committing an fdelete ONLY IF you still have an fd AND it is not connected to /dev/null
//Called during aborting an fcreate (harmless to do, and definitely correct)
static void
finalize_file_removal(DICTIONARY_ID dict_id, void * extra) {
toku_ltm *ltm = (toku_ltm*) extra;
if (ltm) {
//Poison the lock tree to prevent a future file from re-using it.
toku_ltm_invalidate_lt(ltm, dict_id);
}
}
// see if we can acquire a table lock for the given dname.
// requires: write lock on dname in the directory. dictionary
// open, close, and begin checkpoint cannot occur.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment