mirror of
https://github.com/MariaDB/server.git
synced 2025-02-02 12:01:42 +01:00
fixes #187 Add a paranoid invariant that left endpoints are <= right
endpoints on acquire and release.
This commit is contained in:
parent
7a5f8ba8a8
commit
ddacebb1ea
1 changed files with 6 additions and 0 deletions
|
@ -412,6 +412,9 @@ int locktree::acquire_lock(bool is_write_request, TXNID txnid,
|
|||
|
||||
int locktree::try_acquire_lock(bool is_write_request, TXNID txnid,
|
||||
const DBT *left_key, const DBT *right_key, txnid_set *conflicts, bool big_txn) {
|
||||
// All ranges in the locktree must have left endpoints <= right endpoints.
|
||||
// Range comparisons rely on this fact, so we make a paranoid invariant here.
|
||||
paranoid_invariant(m_cmp->compare(left_key, right_key) <= 0);
|
||||
int r = m_mgr->check_current_lock_constraints(big_txn);
|
||||
if (r == 0) {
|
||||
r = acquire_lock(is_write_request, txnid, left_key, right_key, conflicts);
|
||||
|
@ -551,6 +554,9 @@ void locktree::release_locks(TXNID txnid, const range_buffer *ranges) {
|
|||
while (iter.current(&rec)) {
|
||||
const DBT *left_key = rec.get_left_key();
|
||||
const DBT *right_key = rec.get_right_key();
|
||||
// All ranges in the locktree must have left endpoints <= right endpoints.
|
||||
// Range comparisons rely on this fact, so we make a paranoid invariant here.
|
||||
paranoid_invariant(m_cmp->compare(left_key, right_key) <= 0);
|
||||
remove_overlapping_locks_for_txnid(txnid, left_key, right_key);
|
||||
iter.next();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue