From 361e8284f3b8fadc8d95dcc43a8e5d01ca9997c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Sat, 12 Oct 2019 15:28:55 +0300 Subject: [PATCH] MDEV-20813 Assertion failure in buf_flush_init_for_writing() for innodb_immediate_scrub_data_uncompressed=ON The assertion that was added in commit c0c003beb48b099b5e6516e9d36adf096cd2d09c to augment the fix of MDEV-20805 turns out to be invalid when innodb_immediate_scrub_data_uncompressed is enabled. In this mode, fsp_init_file_page() will be invoked on data pages that have been freed, causing writes of almost-all-zero pages. btr_page_free(): Adjust the comment. buf_flush_init_for_writing(): Disable the assertion with a note that it should be re-enabled in MDEV-15528. --- storage/innobase/btr/btr0btr.cc | 8 +++++--- storage/innobase/buf/buf0flu.cc | 7 +++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 212b6489f29..a325475cdb5 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -761,9 +761,11 @@ void btr_page_free(dict_index_t* index, buf_block_t* block, mtr_t* mtr, ut_ad(mtr_is_block_fix(mtr, block, MTR_MEMO_PAGE_X_FIX, index->table)); if (srv_immediate_scrub_data_uncompressed) { - /* In MDEV-15528 this call must be removed, and we should - zero out the page after the redo log for this mini-transaction - has been durably written. */ + /* In MDEV-15528 this code must be removed and the + check in buf_flush_init_for_writing() re-enabled. We + should zero out the page after the redo log for this + mini-transaction has been durably written. The log + would include the 10.4 MLOG_INIT_FREE_PAGE record. */ fsp_init_file_page(fil_space_get(index->space), block, mtr); } } diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 32d5ba34ddb..3c3cc99de72 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -856,7 +856,14 @@ buf_flush_init_for_writing( || &block->page.zip == page_zip_); ut_ad(!srv_safe_truncate || !block || newest_lsn); ut_ad(page); +#if 0 /* MDEV-15528 TODO: reinstate this check */ + /* innodb_immediate_scrub_data_uncompressed=ON would cause + fsp_init_file_page() to be called on freed pages, and thus + cause them to be written as almost-all-zeroed. + In MDEV-15528 we should change that implement an option to + make freed pages appear all-zero, bypassing this code. */ ut_ad(!srv_safe_truncate || !newest_lsn || fil_page_get_type(page)); +#endif if (page_zip_) { page_zip_des_t* page_zip;