MDEV-32151 InnoDB scrubbing doesn't write zero while freeing the page for temporary tablespace

- InnoDB fails to mark the page status as FREED during freeing
of page for temporary tablespace. This behaviour affects
scrubbing and doesn't write all zeroes in file even though
pages are freed.

mtr_t::free(): Mark the page as freed for temporary tablespace
also
parent 0f870914
......@@ -1237,62 +1237,60 @@ void mtr_t::free(const fil_space_t &space, uint32_t offset)
ut_ad(is_named_space(&space));
ut_ad(!m_freed_space || m_freed_space == &space);
if (is_logged())
{
buf_block_t *freed= nullptr;
const page_id_t id{space.id, offset};
buf_block_t *freed= nullptr;
const page_id_t id{space.id, offset};
for (auto it= m_memo.end(); it != m_memo.begin(); )
for (auto it= m_memo.end(); it != m_memo.begin(); )
{
it--;
next:
mtr_memo_slot_t &slot= *it;
buf_block_t *block= static_cast<buf_block_t*>(slot.object);
ut_ad(block);
if (block == freed)
{
it--;
next:
mtr_memo_slot_t &slot= *it;
buf_block_t *block= static_cast<buf_block_t*>(slot.object);
ut_ad(block);
if (block == freed)
if (slot.type & (MTR_MEMO_PAGE_SX_FIX | MTR_MEMO_PAGE_X_FIX))
slot.type= MTR_MEMO_PAGE_X_FIX;
else
{
if (slot.type & (MTR_MEMO_PAGE_SX_FIX | MTR_MEMO_PAGE_X_FIX))
slot.type= MTR_MEMO_PAGE_X_FIX;
else
{
ut_ad(slot.type == MTR_MEMO_BUF_FIX);
block->page.unfix();
m_memo.erase(it, it + 1);
goto next;
}
ut_ad(slot.type == MTR_MEMO_BUF_FIX);
block->page.unfix();
m_memo.erase(it, it + 1);
goto next;
}
else if (slot.type & (MTR_MEMO_PAGE_X_FIX | MTR_MEMO_PAGE_SX_FIX) &&
}
else if (slot.type & (MTR_MEMO_PAGE_X_FIX | MTR_MEMO_PAGE_SX_FIX) &&
block->page.id() == id)
{
ut_ad(!block->page.is_freed());
ut_ad(!freed);
freed= block;
if (!(slot.type & MTR_MEMO_PAGE_X_FIX))
{
ut_d(bool upgraded=) block->page.lock.x_lock_upgraded();
ut_ad(upgraded);
}
if (id.space() >= SRV_TMP_SPACE_ID)
{
block->page.set_temp_modified();
slot.type= MTR_MEMO_PAGE_X_FIX;
}
else
{
ut_ad(!block->page.is_freed());
ut_ad(!freed);
freed= block;
if (!(slot.type & MTR_MEMO_PAGE_X_FIX))
{
ut_d(bool upgraded=) block->page.lock.x_lock_upgraded();
ut_ad(upgraded);
}
if (id.space() >= SRV_TMP_SPACE_ID)
{
block->page.set_temp_modified();
slot.type= MTR_MEMO_PAGE_X_FIX;
}
else
{
slot.type= MTR_MEMO_PAGE_X_MODIFY;
if (!m_made_dirty)
m_made_dirty= block->page.oldest_modification() <= 1;
}
slot.type= MTR_MEMO_PAGE_X_MODIFY;
if (!m_made_dirty)
m_made_dirty= block->page.oldest_modification() <= 1;
}
#ifdef BTR_CUR_HASH_ADAPT
if (block->index)
btr_search_drop_page_hash_index(block, false);
if (block->index)
btr_search_drop_page_hash_index(block, false);
#endif /* BTR_CUR_HASH_ADAPT */
block->page.set_freed(block->page.state());
}
block->page.set_freed(block->page.state());
}
}
if (is_logged())
m_log.close(log_write<FREE_PAGE>(id, nullptr));
}
}
void small_vector_base::grow_by_1(void *small, size_t element_size)
......
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