A follow-up fix for buffer pool mutex split patch might be suboptimal, commit 2
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
MySQL Server |
Unknown
|
Unknown
|
||||
Percona Server moved to https://jira.percona.com/projects/PS | Status tracked in 5.7 | |||||
5.5 |
Invalid
|
Undecided
|
Unassigned | |||
5.6 |
Invalid
|
Undecided
|
Unassigned | |||
5.7 |
Invalid
|
Undecided
|
Unassigned | |||
8.0 |
Fix Committed
|
Wishlist
|
Unassigned |
Bug Description
A copy of https:/
[27 Feb 13:35] Laurynas Biveinis
Description:
Another follow-up commits to the buffer pool mutex split patch (bug 75534) is [1]. We have debugged what seems to be exact same bug and believe a fix with less locking is possible.
The bug is one thread storing a buffer pool block pointer for optimistic access, with all the buffer pool latches released, and another thread freeing the page and reading in another page. Then it becomes possible that the 1st thread calls buf_page_
[1] avoids the above by putting buffer pool page initialisation into a block mutex critical section, serializing it with buf_page_
I'd also replace the buf_fix_count reset to zero in buf_page_init_low with a release build assert checking the same.
(Also in [1], I'd check if the added assert "ut_ad(count + 1 != 0)" to catch buf_block_unfix overflow would not be subject to some type promotion rules making it always false - in my debugging I could get it to fire only by rewriting it as "ut_ad(count != UINT32_MAX);")
[1]:
commit cbc524750c486e9
Author: Shaohua Wang <email address hidden>
Date: Wed Jun 8 10:29:10 2016 +0800
BUG#23067038 ASSERTION FAILURE: BUF0BUF.
It's a regression of wl#8423 InnoDB: Split the buffer pool mutex.
There is a race: Thread 1, we set buf_fix_count to 0 in buf_page_init().
Thread 2, we decrease buf_fix_count to 0xffffffff in buf_page_
Thread 2, we increase buf_fix_count to 0 in buf_page_get_gen(). Thread 3,
we evict the page from LRU list. Thread 2, assert fails: buf_page_in_file().
The root cause is missing block mutex protection for buf_page_init().
Reviewed-by: Debarun Banerjee <email address hidden>
RB: 12456
How to repeat:
Code review
https:/ /github. com/laurynas- biveinis/ percona- server/ commit/ adcf40ffa854027 9d71e84e643654f fcff428a44