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
=== modified file 'Percona-Server/storage/innobase/buf/buf0buf.c'
--- Percona-Server/storage/innobase/buf/buf0buf.c 2013-10-23 08:23:08 +0000
+++ Percona-Server/storage/innobase/buf/buf0buf.c 2013-11-27 13:06:35 +0000
@@ -4754,12 +4754,16 @@
4754 case BUF_BLOCK_FILE_PAGE:4754 case BUF_BLOCK_FILE_PAGE:
4755 /* uncompressed page */4755 /* uncompressed page */
4756 break;4756 break;
4757 case BUF_BLOCK_REMOVE_HASH:
4758 /* We hold flush list but not LRU list mutex here.
4759 Thus encountering BUF_BLOCK_REMOVE_HASH pages is
4760 possible. */
4761 break;
4757 case BUF_BLOCK_ZIP_FREE:4762 case BUF_BLOCK_ZIP_FREE:
4758 case BUF_BLOCK_ZIP_PAGE:4763 case BUF_BLOCK_ZIP_PAGE:
4759 case BUF_BLOCK_NOT_USED:4764 case BUF_BLOCK_NOT_USED:
4760 case BUF_BLOCK_READY_FOR_USE:4765 case BUF_BLOCK_READY_FOR_USE:
4761 case BUF_BLOCK_MEMORY:4766 case BUF_BLOCK_MEMORY:
4762 case BUF_BLOCK_REMOVE_HASH:
4763 ut_error;4767 ut_error;
4764 break;4768 break;
4765 }4769 }
47664770
=== modified file 'Percona-Server/storage/innobase/buf/buf0flu.c'
--- Percona-Server/storage/innobase/buf/buf0flu.c 2013-10-23 08:23:08 +0000
+++ Percona-Server/storage/innobase/buf/buf0flu.c 2013-11-27 13:06:35 +0000
@@ -1605,6 +1605,16 @@
1605 ut_ad(block_mutex);1605 ut_ad(block_mutex);
1606 }1606 }
16071607
1608 if (UNIV_UNLIKELY(buf_page_get_state(bpage)
1609 == BUF_BLOCK_REMOVE_HASH)) {
1610
1611 /* In case we don't hold the LRU list mutex, we may see a page
1612 that is about to be relocated on the flush list. Do not
1613 attempt to flush it. */
1614 ut_ad(flush_type == BUF_FLUSH_LIST);
1615 return (flushed);
1616 }
1617
1608 ut_a(buf_page_in_file(bpage));1618 ut_a(buf_page_in_file(bpage));
16091619
1610 if (buf_flush_ready_for_flush(bpage, flush_type)) {1620 if (buf_flush_ready_for_flush(bpage, flush_type)) {

Subscribers

People subscribed via source and target branches