mirror of
https://github.com/MariaDB/server.git
synced 2025-02-02 03:51:50 +01:00
refs #5654, grab parent's txn lock when moving rollback entries from child to parent when the child commits. This prevents a race condition with a hot indexer simultaneously adding something to the parent's entry
git-svn-id: file:///svn/toku/tokudb@50375 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
18243fc976
commit
f4096a581d
2 changed files with 4 additions and 0 deletions
|
@ -156,6 +156,7 @@ int toku_rollback_commit(TOKUTXN txn, LSN lsn) {
|
|||
// list to the end of the parent log entry list.
|
||||
if (txn_has_current_rollback_log(txn)) {
|
||||
//Pin parent log
|
||||
toku_txn_lock(txn->parent);
|
||||
ROLLBACK_LOG_NODE parent_log;
|
||||
toku_get_and_pin_rollback_log_for_new_entry(txn->parent, &parent_log);
|
||||
|
||||
|
@ -203,6 +204,7 @@ int toku_rollback_commit(TOKUTXN txn, LSN lsn) {
|
|||
toku_maybe_spill_rollbacks(txn->parent, parent_log);
|
||||
toku_rollback_log_unpin(txn->parent, parent_log);
|
||||
assert(r == 0);
|
||||
toku_txn_unlock(txn->parent);
|
||||
}
|
||||
|
||||
// Note the open brts, the omts must be merged
|
||||
|
|
|
@ -294,6 +294,7 @@ indexer_undo_do_provisional(DB_INDEXER *indexer, DB *hotdb, ULEHANDLE ule, struc
|
|||
case TOKUTXN_LIVE:
|
||||
case TOKUTXN_PREPARING:
|
||||
invariant(this_xid_state != TOKUTXN_ABORTING);
|
||||
invariant(toku_txn_get_state(curr_txn) == TOKUTXN_LIVE || toku_txn_get_state(curr_txn) == TOKUTXN_PREPARING);
|
||||
result = indexer_ft_delete_provisional(indexer, hotdb, &indexer->i->hotkey, xids, curr_txn);
|
||||
if (result == 0) {
|
||||
indexer_lock_key(indexer, hotdb, &indexer->i->hotkey, prov_ids[0], curr_txn);
|
||||
|
@ -327,6 +328,7 @@ indexer_undo_do_provisional(DB_INDEXER *indexer, DB *hotdb, ULEHANDLE ule, struc
|
|||
case TOKUTXN_LIVE:
|
||||
case TOKUTXN_PREPARING:
|
||||
assert(this_xid_state != TOKUTXN_ABORTING);
|
||||
invariant(toku_txn_get_state(curr_txn) == TOKUTXN_LIVE || toku_txn_get_state(curr_txn) == TOKUTXN_PREPARING);
|
||||
result = indexer_ft_insert_provisional(indexer, hotdb, &indexer->i->hotkey, &indexer->i->hotval, xids, curr_txn);
|
||||
if (result == 0) {
|
||||
indexer_lock_key(indexer, hotdb, &indexer->i->hotkey, prov_ids[0], prov_txns[0]);
|
||||
|
|
Loading…
Add table
Reference in a new issue