diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-01-14 14:26:24 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-01-14 14:26:24 +0200 |
commit | deadec4e689c9435e20ebb89fd8f84d3f0f90ff3 (patch) | |
tree | d3d4ee6b760db5a88054216193d51eee153233e9 /storage/innobase/fsp/fsp0fsp.cc | |
parent | e4205fba7c02b119ceea251f1484730066c2dedc (diff) | |
download | mariadb-git-deadec4e689c9435e20ebb89fd8f84d3f0f90ff3.tar.gz |
MDEV-24569: Change buffer merge modifies freed page
Starting with MDEV-15528, we will avoid writing freed pages back
to data files. During stress testing, the assertion
mach_read_from_4(frame + 4U) == block.page.id().page_no()
failed in log_phys_t::apply(), because before the server was
killed and restarted, change buffer merge was executed on a
previously freed page.
During recovery, the assertion would fail when InnoDB would apply
a FREE_PAGE and a WRITE record to the page.
ibuf_merge_or_delete_for_page(): Before applying any changes, check whether
the secondary index leaf page has already been freed according to
the allocation bitmap page. If it is freed, then we must reset the bits
in change buffer bitmap page.
ibuf_reset_bitmap(): Auxiliary function for repeated code.
mtr_t::sx_lock_space(): Replaces mtr_t::x_lock_space(). Due to the
lazy approach of the change buffer, The function
ibuf_merge_or_delete_for_page() may be executed in buf_page_create()
while the tablespace is already X-latched. An S-latch must not be
acquired while the thread already holds an X-latch, but a redundant
SX-latch is fine.
The fix was developed by Thirunarayanan Balathandayuthapani.
Diffstat (limited to 'storage/innobase/fsp/fsp0fsp.cc')
-rw-r--r-- | storage/innobase/fsp/fsp0fsp.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index 5fed394b647..1c88d98c3b8 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2020, MariaDB Corporation. +Copyright (c) 2017, 2021, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -404,7 +404,7 @@ xdes_get_descriptor_const( page_no_t offset, mtr_t* mtr) { - ut_ad(mtr->memo_contains(space->latch, MTR_MEMO_S_LOCK)); + ut_ad(mtr->memo_contains(space->latch, MTR_MEMO_SX_LOCK)); ut_ad(offset < space->free_limit); ut_ad(offset < space->size_in_header); @@ -2569,7 +2569,7 @@ fseg_page_is_free(fil_space_t* space, unsigned page) page); mtr.start(); - mtr_s_lock_space(space, &mtr); + mtr_sx_lock_space(space, &mtr); if (page >= space->free_limit || page >= space->size_in_header) { is_free = true; |