Bug #74209 btr_cur_search_to_nth_level() should check modify intention also for leaf pages
Submitted: 3 Oct 2014 8:38 Modified: 14 Oct 2014 23:04
Reporter: Yasufumi Kinoshita Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:5.7.5 OS:Any
Assigned to: CPU Architecture:Any

[3 Oct 2014 8:38] Yasufumi Kinoshita
Description:
btr_cur_search_to_nth_level() is optimized block latches for each intention (insert-only or delete-only or both).

But the lock intention should be checked also for leaf page.
(Currently only checks non-leaf upper pages)

Otherwise, the latch order violation might be caused by the insufficient intention
and might cause deadlock with the another threads.

This is bug of WL#6326 and for mysql-5.7 only.

How to repeat:
Benchmark or heavy-load RW-test might cause hangup or deadlock assertion error.

At least I have got reported 2 core files and analyzed them.

Suggested fix:
Calling btr_cur_need_opposite_intention() also for the leaf page.
And retry if the intention is not fit.
[14 Oct 2014 22:38] Daniel Price
Posted by developer:
 
revno: 9033
committer: Yasufumi Kinoshita <yasufumi.kinoshita@oracle.com>
branch nick: mysql-trunk
timestamp: Fri 2014-10-10 18:58:29 +0900
message:
  Bug#19729316 : BTR_CUR_SEARCH_TO_NTH_LEVEL() SHOULD CHECK MODIFY INTENTION ALSO FOR LEAF PAGES
  
  Because btr_insert_into_right_sibling() might cause deletion of node_ptr at parent page,
  the intention check (insert-only, delete-only, or both) should be done even for leaf pages.
  
  Approved by Jimmy Yang in rb#6904
[14 Oct 2014 23:04] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 5.7.6 release, and here's the changelog entry:

"btr_insert_into_right_sibling()" could delete node pointers at the
parent page. To avoid latch order violations and deadlocks with other
threads, lock intention is now checked for leaf pages as well as upper
non-leaf pages.