Commit 3ff15ca1 authored by Vlad Lesin's avatar Vlad Lesin

MDEV-24719 backport MDEV-24705 from 10.5 to 10.2, 10.3, 10.4

Do not mark page as modified if log mode is MTR_LOG_ALL. Set log mode to
MTR_LOG_NO_REDO instead of MTR_LOG_ALL for the cases when pages must be
marked as modified but no log records are written for them.
parent 83bf2fa7
......@@ -1496,7 +1496,7 @@ btr_page_reorganize_low(
data_size1 = page_get_data_size(page);
max_ins_size1 = page_get_max_insert_size_after_reorganize(page, 1);
/* Turn logging off */
mtr_log_t log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE);
mtr_log_t log_mode = mtr_set_log_mode(mtr, MTR_LOG_NO_REDO);
temp_block = buf_block_alloc(buf_pool);
temp_page = temp_block->frame;
......
......@@ -203,10 +203,6 @@ mtr_t::set_log_mode(mtr_log_t mode)
const mtr_log_t old_mode = m_log_mode;
switch (old_mode) {
case MTR_LOG_NO_REDO:
/* Once this mode is set, it must not be changed. */
ut_ad(mode == MTR_LOG_NO_REDO || mode == MTR_LOG_NONE);
return(old_mode);
case MTR_LOG_NONE:
if (mode == old_mode || mode == MTR_LOG_SHORT_INSERTS) {
/* Keep MTR_LOG_NONE. */
......@@ -214,12 +210,10 @@ mtr_t::set_log_mode(mtr_log_t mode)
}
/* fall through */
case MTR_LOG_SHORT_INSERTS:
ut_ad(mode == MTR_LOG_ALL);
ut_ad(mode == MTR_LOG_ALL || mode == MTR_LOG_NO_REDO);
/* fall through */
case MTR_LOG_NO_REDO:
case MTR_LOG_ALL:
/* MTR_LOG_NO_REDO can only be set before generating
any redo log records. */
ut_ad(mode != MTR_LOG_NO_REDO || m_n_log_recs == 0);
m_log_mode = mode;
return(old_mode);
}
......
......@@ -2267,7 +2267,7 @@ void recv_recover_page(buf_page_t* bpage)
{
mtr_t mtr;
mtr.start();
mtr.set_log_mode(MTR_LOG_NONE);
mtr.set_log_mode(MTR_LOG_NO_REDO);
ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE);
buf_block_t* block = reinterpret_cast<buf_block_t*>(bpage);
......@@ -2385,7 +2385,7 @@ static buf_block_t* recv_recovery_create_page_low(const page_id_t page_id,
goto init_fail;
mtr.start();
mtr.set_log_mode(MTR_LOG_NONE);
mtr.set_log_mode(MTR_LOG_NO_REDO);
buf_block_t* block = buf_page_create(page_id, page_size_t(space->flags),
&mtr);
if (recv_addr->state == RECV_PROCESSED)
......@@ -2511,7 +2511,7 @@ void recv_apply_hashed_log_recs(bool last_batch)
if (recv_addr->state == RECV_NOT_PROCESSED) {
apply:
mtr.start();
mtr.set_log_mode(MTR_LOG_NONE);
mtr.set_log_mode(MTR_LOG_NO_REDO);
if (buf_block_t* block = buf_page_get_low(
page_id, univ_page_size,
RW_X_LATCH, NULL,
......
......@@ -1006,7 +1006,7 @@ struct FindModifiedSpacePage
void mtr_t::memo_modify_page(ulint space, ulint page)
{
if (m_memo.empty())
if (m_log_mode == MTR_LOG_NONE || m_memo.empty())
return;
Iterate<FindModifiedSpacePage> iteration(
(FindModifiedSpacePage(space, page)));
......@@ -1045,7 +1045,7 @@ struct FindModifiedPtr
@param[in] ptr pointer to within buffer frame */
void mtr_t::memo_modify_page(const byte *ptr)
{
if (m_memo.empty())
if (m_log_mode == MTR_LOG_NONE || m_memo.empty())
return;
Iterate<FindModifiedPtr> iteration((FindModifiedPtr(ptr)));
......
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