Skip to content
Permalink
Browse files
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 4179f93 (MDEV-18976).

Tested by: Matthias Leich
  • Loading branch information
dr-m committed Jun 14, 2022
1 parent 6c669b9 commit 6c82ab4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
@@ -290,9 +290,9 @@ struct mtr_t {
@param[in] type object type: MTR_MEMO_PAGE_X_FIX, ... */
void release_page(const void *ptr, mtr_memo_type_t type);

private:
/** Note that the mini-transaction will modify data. */
void flag_modified() { m_modifications = true; }
private:
/** Mark the given latched page as modified.
@param block page that will be modified */
void modify(const buf_block_t& block);
@@ -46,7 +46,7 @@ mtr_t::memo_push(void* object, mtr_memo_type_t type)
ut_ad(object != NULL);
ut_ad(type >= MTR_MEMO_PAGE_S_FIX);
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
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)
block->fix();
mtr.commit();
mtr.start();
mtr.flag_modified();
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_hdr->page.lock.x_lock();
block->page.lock.x_lock();

0 comments on commit 6c82ab4

Please sign in to comment.