Commit c613d420 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:4968], remove dbs_that_must_close_before_abort

git-svn-id: file:///svn/toku/tokudb@44151 c7de825b-a66e-492c-adef-691d508d4ae1
parent 9edd166f
...@@ -31,7 +31,6 @@ struct __toku_db_internal { ...@@ -31,7 +31,6 @@ struct __toku_db_internal {
struct simple_dbt skey, sval; // static key and value struct simple_dbt skey, sval; // static key and value
BOOL key_compare_was_set; // true if a comparison function was provided before call to db->open() (if false, use environment's comparison function). BOOL key_compare_was_set; // true if a comparison function was provided before call to db->open() (if false, use environment's comparison function).
char *dname; // dname is constant for this handle (handle must be closed before file is renamed) char *dname; // dname is constant for this handle (handle must be closed before file is renamed)
struct toku_list dbs_that_must_close_before_abort;
DB_INDEXER *indexer; DB_INDEXER *indexer;
}; };
...@@ -209,7 +208,6 @@ struct __toku_db_txn_internal { ...@@ -209,7 +208,6 @@ struct __toku_db_txn_internal {
u_int32_t flags; u_int32_t flags;
TOKU_ISOLATION iso; TOKU_ISOLATION iso;
DB_TXN *child; DB_TXN *child;
struct toku_list dbs_that_must_close_before_abort;
toku_mutex_t txn_mutex; toku_mutex_t txn_mutex;
}; };
struct __toku_db_txn_external { struct __toku_db_txn_external {
......
...@@ -122,10 +122,6 @@ toku_db_close(DB * db) { ...@@ -122,10 +122,6 @@ toku_db_close(DB * db) {
// internal (non-user) dictionary has no dname // internal (non-user) dictionary has no dname
env_note_db_closed(db->dbenv, db); // tell env that this db is no longer in use by the user of this api (user-closed, may still be in use by fractal tree internals) env_note_db_closed(db->dbenv, db); // tell env that this db is no longer in use by the user of this api (user-closed, may still be in use by fractal tree internals)
} }
//Remove from transaction's list of 'must close' if necessary.
if (!toku_list_empty(&db->i->dbs_that_must_close_before_abort))
toku_list_remove(&db->i->dbs_that_must_close_before_abort);
r = toku_ft_handle_close(db->i->ft_handle, FALSE, ZERO_LSN); r = toku_ft_handle_close(db->i->ft_handle, FALSE, ZERO_LSN);
if (r == 0) { if (r == 0) {
// go ahead and close this DB handle right away. // go ahead and close this DB handle right away.
...@@ -393,13 +389,6 @@ db_open_iname(DB * db, DB_TXN * txn, const char *iname_in_env, u_int32_t flags, ...@@ -393,13 +389,6 @@ db_open_iname(DB * db, DB_TXN * txn, const char *iname_in_env, u_int32_t flags,
r = toku_ltm_get_lt(db->dbenv->i->ltm, &db->i->lt, db->i->dict_id, db->cmp_descriptor, toku_ft_get_bt_compare(db->i->ft_handle)); r = toku_ltm_get_lt(db->dbenv->i->ltm, &db->i->lt, db->i->dict_id, db->cmp_descriptor, toku_ft_get_bt_compare(db->i->ft_handle));
if (r!=0) { goto error_cleanup; } if (r!=0) { goto error_cleanup; }
} }
//Add to transaction's list of 'must close' if necessary.
if (txn) {
//Do last so we don't have to undo.
toku_list_push(&db_txn_struct_i(txn)->dbs_that_must_close_before_abort,
&db->i->dbs_that_must_close_before_abort);
}
return 0; return 0;
error_cleanup: error_cleanup:
...@@ -794,7 +783,6 @@ int toku_setup_db_internal (DB **dbp, DB_ENV *env, u_int32_t flags, FT_HANDLE br ...@@ -794,7 +783,6 @@ int toku_setup_db_internal (DB **dbp, DB_ENV *env, u_int32_t flags, FT_HANDLE br
return ENOMEM; return ENOMEM;
} }
memset(result->i, 0, sizeof *result->i); memset(result->i, 0, sizeof *result->i);
toku_list_init(&result->i->dbs_that_must_close_before_abort);
result->i->ft_handle = brt; result->i->ft_handle = brt;
result->i->opened = is_open; result->i->opened = is_open;
*dbp = result; *dbp = result;
......
...@@ -146,22 +146,6 @@ toku_txn_commit_only(DB_TXN * txn, u_int32_t flags, ...@@ -146,22 +146,6 @@ toku_txn_commit_only(DB_TXN * txn, u_int32_t flags,
toku_multi_operation_client_unlock(); toku_multi_operation_client_unlock();
} }
toku_txn_maybe_fsync_log(logger, do_fsync_lsn, do_fsync); toku_txn_maybe_fsync_log(logger, do_fsync_lsn, do_fsync);
//Promote list to parent (dbs that must close before abort)
if (txn->parent) {
//Combine lists.
while (!toku_list_empty(&db_txn_struct_i(txn)->dbs_that_must_close_before_abort)) {
struct toku_list *list = toku_list_pop(&db_txn_struct_i(txn)->dbs_that_must_close_before_abort);
toku_list_push(&db_txn_struct_i(txn->parent)->dbs_that_must_close_before_abort, list);
}
}
else {
//Empty the list
while (!toku_list_empty(&db_txn_struct_i(txn)->dbs_that_must_close_before_abort)) {
toku_list_pop(&db_txn_struct_i(txn)->dbs_that_must_close_before_abort);
}
}
if (flags!=0) return EINVAL; if (flags!=0) return EINVAL;
return r; return r;
} }
...@@ -204,9 +188,6 @@ toku_txn_abort_only(DB_TXN * txn, ...@@ -204,9 +188,6 @@ toku_txn_abort_only(DB_TXN * txn,
db_txn_struct_i(txn->parent)->child=NULL; db_txn_struct_i(txn->parent)->child=NULL;
} }
//All dbs that must close before abort, must now be closed
assert(toku_list_empty(&db_txn_struct_i(txn)->dbs_that_must_close_before_abort));
int r = toku_txn_abort_txn(db_txn_struct_i(txn)->tokutxn, poll, poll_extra); int r = toku_txn_abort_txn(db_txn_struct_i(txn)->tokutxn, poll, poll_extra);
if (r!=0 && !toku_env_is_panicked(txn->mgrp)) { if (r!=0 && !toku_env_is_panicked(txn->mgrp)) {
env_panic(txn->mgrp, r, "Error during abort.\n"); env_panic(txn->mgrp, r, "Error during abort.\n");
...@@ -461,7 +442,6 @@ toku_txn_begin(DB_ENV *env, DB_TXN * stxn, DB_TXN ** txn, u_int32_t flags) { ...@@ -461,7 +442,6 @@ toku_txn_begin(DB_ENV *env, DB_TXN * stxn, DB_TXN ** txn, u_int32_t flags) {
memset(db_txn_struct_i(result), 0, sizeof *db_txn_struct_i(result)); memset(db_txn_struct_i(result), 0, sizeof *db_txn_struct_i(result));
db_txn_struct_i(result)->flags = txn_flags; db_txn_struct_i(result)->flags = txn_flags;
db_txn_struct_i(result)->iso = child_isolation; db_txn_struct_i(result)->iso = child_isolation;
toku_list_init(&db_txn_struct_i(result)->dbs_that_must_close_before_abort);
// we used to initialize the transaction's lth here. // we used to initialize the transaction's lth here.
// Now we initialize the lth only if the transaction needs the lth, // Now we initialize the lth only if the transaction needs the lth,
...@@ -539,7 +519,6 @@ void toku_keep_prepared_txn_callback (DB_ENV *env, TOKUTXN tokutxn) { ...@@ -539,7 +519,6 @@ void toku_keep_prepared_txn_callback (DB_ENV *env, TOKUTXN tokutxn) {
} }
#endif #endif
memset(db_txn_struct_i(result), 0, sizeof *db_txn_struct_i(result)); memset(db_txn_struct_i(result), 0, sizeof *db_txn_struct_i(result));
toku_list_init(&db_txn_struct_i(result)->dbs_that_must_close_before_abort);
{ {
int r = toku_lth_create(&db_txn_struct_i(result)->lth); int r = toku_lth_create(&db_txn_struct_i(result)->lth);
......
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