Merge lp:~laurynas-biveinis/percona-server/bug1227581-5.5 into lp:percona-server/5.5

Proposed by Laurynas Biveinis
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 598
Proposed branch: lp:~laurynas-biveinis/percona-server/bug1227581-5.5
Merge into: lp:percona-server/5.5
Diff against target: 42 lines (+15/-1)
2 files modified
Percona-Server/storage/innobase/buf/buf0buf.c (+5/-1)
Percona-Server/storage/innobase/buf/buf0flu.c (+10/-0)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/bug1227581-5.5
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve
George Ormond Lorch III (community) g2 Approve
Review via email: mp+196895@code.launchpad.net

Description of the change

BT 37223

Backport the bug 1227581 fix from 5.6:

The issue is that buf_LRU_free_page() may perform a flush list
relocation for a dirty zip page, making it possible to observe a page
in BUF_BLOCK_REMOVE_HASH state on the flush list between
buf_LRU_block_remove_hashed() and buf_flush_relocate_on_flush_list()
calls, if another thread reads flush list pages without the LRU list
mutex.

Places where a thread iterates through the flush list without the LRU
list mutex and does not expect to see a BUF_BLOCK_REMOVE_HASH page are
buf_flush_page_and_try_neighbors() and
buf_get_latched_pages_number_instance(). The fix is to accept such
pages there:
- in buf_flush_page_and_try_neighbors() do not attempt to flush such
  page.
- in buf_get_latched_pages_number_instance(), silently accept such
  page as BUF_BLOCK_FILE_PAGE.

http://jenkins.percona.com/job/percona-server-5.5-param/897/

I have reviewed the 5.5 code BUF_BLOCK_REMOVE_HASH/buf_page_in_file() uses, and haven't found any new places to fix to what was fixed in 5.6. So this MP is an "automerge" of the 5.6 fix with the bits in new-in-5.6 code dropped, thus I'm submitting it as an G2.

To post a comment you must log in.
Revision history for this message
George Ormond Lorch III (gl-az) :
review: Approve (g2)
Revision history for this message
Stewart Smith (stewart) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Percona-Server/storage/innobase/buf/buf0buf.c'
2--- Percona-Server/storage/innobase/buf/buf0buf.c 2013-10-23 08:23:08 +0000
3+++ Percona-Server/storage/innobase/buf/buf0buf.c 2013-11-27 13:06:35 +0000
4@@ -4754,12 +4754,16 @@
5 case BUF_BLOCK_FILE_PAGE:
6 /* uncompressed page */
7 break;
8+ case BUF_BLOCK_REMOVE_HASH:
9+ /* We hold flush list but not LRU list mutex here.
10+ Thus encountering BUF_BLOCK_REMOVE_HASH pages is
11+ possible. */
12+ break;
13 case BUF_BLOCK_ZIP_FREE:
14 case BUF_BLOCK_ZIP_PAGE:
15 case BUF_BLOCK_NOT_USED:
16 case BUF_BLOCK_READY_FOR_USE:
17 case BUF_BLOCK_MEMORY:
18- case BUF_BLOCK_REMOVE_HASH:
19 ut_error;
20 break;
21 }
22
23=== modified file 'Percona-Server/storage/innobase/buf/buf0flu.c'
24--- Percona-Server/storage/innobase/buf/buf0flu.c 2013-10-23 08:23:08 +0000
25+++ Percona-Server/storage/innobase/buf/buf0flu.c 2013-11-27 13:06:35 +0000
26@@ -1605,6 +1605,16 @@
27 ut_ad(block_mutex);
28 }
29
30+ if (UNIV_UNLIKELY(buf_page_get_state(bpage)
31+ == BUF_BLOCK_REMOVE_HASH)) {
32+
33+ /* In case we don't hold the LRU list mutex, we may see a page
34+ that is about to be relocated on the flush list. Do not
35+ attempt to flush it. */
36+ ut_ad(flush_type == BUF_FLUSH_LIST);
37+ return (flushed);
38+ }
39+
40 ut_a(buf_page_in_file(bpage));
41
42 if (buf_flush_ready_for_flush(bpage, flush_type)) {

Subscribers

People subscribed via source and target branches