Skip to content

Commit

Permalink
MDEV-35708 lock_rec_get_prev() returns only the first record lock
Browse files Browse the repository at this point in the history
It's supposed that the function gets the previous lock set on a record.
But if there are several locks set on a record, it will return only the
first one. Continue locks list iteration till the certain lock even if
the certain bit in lock bitmap is set.
  • Loading branch information
vlad-lesin committed Dec 23, 2024
1 parent 07b77e8 commit 0616935
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions storage/innobase/lock/lock0lock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -984,13 +984,14 @@ lock_rec_get_prev(
ut_ad(!in_lock->is_table());
const page_id_t id{in_lock->un_member.rec_lock.page_id};
hash_cell_t *cell= lock_sys.hash_get(in_lock->type_mode).cell_get(id.fold());
lock_t *prev_lock= nullptr;

for (lock_t *lock= lock_sys_t::get_first(*cell, id); lock != in_lock;
lock= lock_rec_get_next_on_page(lock))
if (lock_rec_get_nth_bit(lock, heap_no))
return lock;
prev_lock= lock;

return nullptr;
return prev_lock;
}

/*============= FUNCTIONS FOR ANALYZING RECORD LOCK QUEUE ================*/
Expand Down

0 comments on commit 0616935

Please sign in to comment.