Commit 6c82ab4f authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-28840 innodb_undo_log_truncate is not crash-safe

trx_purge_free_segment(): Do mark that the block will be modified.

It seems possible that this regression was introduced by the
changes to the page-freeing logic
in commit 4179f93d (MDEV-18976).

Tested by: Matthias Leich
parent 6c669b95
...@@ -290,9 +290,9 @@ struct mtr_t { ...@@ -290,9 +290,9 @@ struct mtr_t {
@param[in] type object type: MTR_MEMO_PAGE_X_FIX, ... */ @param[in] type object type: MTR_MEMO_PAGE_X_FIX, ... */
void release_page(const void *ptr, mtr_memo_type_t type); void release_page(const void *ptr, mtr_memo_type_t type);
private:
/** Note that the mini-transaction will modify data. */ /** Note that the mini-transaction will modify data. */
void flag_modified() { m_modifications = true; } void flag_modified() { m_modifications = true; }
private:
/** Mark the given latched page as modified. /** Mark the given latched page as modified.
@param block page that will be modified */ @param block page that will be modified */
void modify(const buf_block_t& block); void modify(const buf_block_t& block);
......
...@@ -46,7 +46,7 @@ mtr_t::memo_push(void* object, mtr_memo_type_t type) ...@@ -46,7 +46,7 @@ mtr_t::memo_push(void* object, mtr_memo_type_t type)
ut_ad(object != NULL); ut_ad(object != NULL);
ut_ad(type >= MTR_MEMO_PAGE_S_FIX); ut_ad(type >= MTR_MEMO_PAGE_S_FIX);
ut_ad(type <= MTR_MEMO_SPACE_S_LOCK); ut_ad(type <= MTR_MEMO_SPACE_S_LOCK);
ut_ad(ut_is_2pow(type)); ut_ad(type == MTR_MEMO_PAGE_X_MODIFY || ut_is_2pow(type));
/* If this mtr has x-fixed a clean page then we set /* If this mtr has x-fixed a clean page then we set
the made_dirty flag. This tells us if we need to the made_dirty flag. This tells us if we need to
......
...@@ -402,8 +402,9 @@ static dberr_t trx_purge_free_segment(trx_rseg_t *rseg, fil_addr_t hdr_addr) ...@@ -402,8 +402,9 @@ static dberr_t trx_purge_free_segment(trx_rseg_t *rseg, fil_addr_t hdr_addr)
block->fix(); block->fix();
mtr.commit(); mtr.commit();
mtr.start(); mtr.start();
mtr.flag_modified();
mtr.memo_push(rseg_hdr, MTR_MEMO_PAGE_X_FIX); mtr.memo_push(rseg_hdr, MTR_MEMO_PAGE_X_FIX);
mtr.memo_push(block, MTR_MEMO_PAGE_X_FIX); mtr.memo_push(block, MTR_MEMO_PAGE_X_MODIFY);
rseg->latch.wr_lock(SRW_LOCK_CALL); rseg->latch.wr_lock(SRW_LOCK_CALL);
rseg_hdr->page.lock.x_lock(); rseg_hdr->page.lock.x_lock();
block->page.lock.x_lock(); block->page.lock.x_lock();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment