Commit a67344b3 authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

refs #5351 tighten up acquire_lock after cleanup


git-svn-id: file:///svn/toku/tokudb@49863 c7de825b-a66e-492c-adef-691d508d4ae1
parent c08bafb3
...@@ -158,7 +158,6 @@ void locktree::update_single_txnid_optimization(TXNID txnid) { ...@@ -158,7 +158,6 @@ void locktree::update_single_txnid_optimization(TXNID txnid) {
// transactions that conflict with this request. // transactions that conflict with this request.
int locktree::acquire_lock(bool is_write_request, TXNID txnid, int locktree::acquire_lock(bool is_write_request, TXNID txnid,
const DBT *left_key, const DBT *right_key, txnid_set *conflicts) { const DBT *left_key, const DBT *right_key, txnid_set *conflicts) {
row_lock lock;
keyrange requested_range; keyrange requested_range;
requested_range.create(left_key, right_key); requested_range.create(left_key, right_key);
...@@ -186,15 +185,14 @@ int locktree::acquire_lock(bool is_write_request, TXNID txnid, ...@@ -186,15 +185,14 @@ int locktree::acquire_lock(bool is_write_request, TXNID txnid,
// so, we must consolidate all existing overlapping ranges and the requested // so, we must consolidate all existing overlapping ranges and the requested
// range into one dominating range. then we insert the dominating range. // range into one dominating range. then we insert the dominating range.
for (size_t i = 0; i < num_overlapping_row_locks; i++) { for (size_t i = 0; i < num_overlapping_row_locks; i++) {
lock = overlapping_row_locks.fetch_unchecked(i); row_lock overlapping_lock = overlapping_row_locks.fetch_unchecked(i);
invariant(lock.txnid == txnid); invariant(overlapping_lock.txnid == txnid);
requested_range.extend(m_cmp, lock.range); requested_range.extend(m_cmp, overlapping_lock.range);
remove_row_lock(&lkr, lock, m_mem_tracker); remove_row_lock(&lkr, overlapping_lock, m_mem_tracker);
} }
lock.range = requested_range; row_lock new_lock = { .range = requested_range, .txnid = txnid };
lock.txnid = txnid; insert_row_lock(&lkr, new_lock, m_mem_tracker);
insert_row_lock(&lkr, lock, m_mem_tracker);
} }
lkr.release(); lkr.release();
......
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