Skip to content

Commit

Permalink
MDEV-17765 lock_discard_page() may fail to discard locks for SPATIAL …
Browse files Browse the repository at this point in the history
…INDEX

lock_discard_page(): Traverse and discard the B-tree record locks
only if they exist. Else, discard the R-tree (spatial) index locks.
  • Loading branch information
dr-m committed Nov 19, 2018
1 parent f037b91 commit cb5bca7
Showing 1 changed file with 37 additions and 30 deletions.
67 changes: 37 additions & 30 deletions storage/innobase/lock/lock0lock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3424,48 +3424,55 @@ lock_update_discard(

lock_mutex_enter();

if (!lock_rec_get_first_on_page(lock_sys->rec_hash, block)
&& (!lock_rec_get_first_on_page(lock_sys->prdt_hash, block))) {
/* No locks exist on page, nothing to do */
if (lock_rec_get_first_on_page(lock_sys->rec_hash, block)) {
ut_ad(!lock_rec_get_first_on_page(lock_sys->prdt_hash, block));
ut_ad(!lock_rec_get_first_on_page(lock_sys->prdt_page_hash,
block));
/* Inherit all the locks on the page to the record and
reset all the locks on the page */

lock_mutex_exit();

return;
}

/* Inherit all the locks on the page to the record and reset all
the locks on the page */
if (page_is_comp(page)) {
rec = page + PAGE_NEW_INFIMUM;

if (page_is_comp(page)) {
rec = page + PAGE_NEW_INFIMUM;
do {
heap_no = rec_get_heap_no_new(rec);

do {
heap_no = rec_get_heap_no_new(rec);
lock_rec_inherit_to_gap(heir_block, block,
heir_heap_no, heap_no);

lock_rec_inherit_to_gap(heir_block, block,
heir_heap_no, heap_no);
lock_rec_reset_and_release_wait(
block, heap_no);

lock_rec_reset_and_release_wait(block, heap_no);
rec = page + rec_get_next_offs(rec, TRUE);
} while (heap_no != PAGE_HEAP_NO_SUPREMUM);
} else {
rec = page + PAGE_OLD_INFIMUM;

rec = page + rec_get_next_offs(rec, TRUE);
} while (heap_no != PAGE_HEAP_NO_SUPREMUM);
} else {
rec = page + PAGE_OLD_INFIMUM;
do {
heap_no = rec_get_heap_no_old(rec);

do {
heap_no = rec_get_heap_no_old(rec);
lock_rec_inherit_to_gap(heir_block, block,
heir_heap_no, heap_no);

lock_rec_inherit_to_gap(heir_block, block,
heir_heap_no, heap_no);
lock_rec_reset_and_release_wait(
block, heap_no);

lock_rec_reset_and_release_wait(block, heap_no);
rec = page + rec_get_next_offs(rec, FALSE);
} while (heap_no != PAGE_HEAP_NO_SUPREMUM);
}

rec = page + rec_get_next_offs(rec, FALSE);
} while (heap_no != PAGE_HEAP_NO_SUPREMUM);
lock_rec_free_all_from_discard_page_low(
block->page.id.space(), block->page.id.page_no(),
lock_sys->rec_hash);
} else {
lock_rec_free_all_from_discard_page_low(
block->page.id.space(), block->page.id.page_no(),
lock_sys->prdt_hash);
lock_rec_free_all_from_discard_page_low(
block->page.id.space(), block->page.id.page_no(),
lock_sys->prdt_page_hash);
}

lock_rec_free_all_from_discard_page(block);

lock_mutex_exit();
}

Expand Down

0 comments on commit cb5bca7

Please sign in to comment.