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( ...@@ -1496,7 +1496,7 @@ btr_page_reorganize_low(
data_size1 = page_get_data_size(page); data_size1 = page_get_data_size(page);
max_ins_size1 = page_get_max_insert_size_after_reorganize(page, 1); max_ins_size1 = page_get_max_insert_size_after_reorganize(page, 1);
/* Turn logging off */ /* 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_block = buf_block_alloc(buf_pool);
temp_page = temp_block->frame; temp_page = temp_block->frame;
......
...@@ -203,10 +203,6 @@ mtr_t::set_log_mode(mtr_log_t mode) ...@@ -203,10 +203,6 @@ mtr_t::set_log_mode(mtr_log_t mode)
const mtr_log_t old_mode = m_log_mode; const mtr_log_t old_mode = m_log_mode;
switch (old_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: case MTR_LOG_NONE:
if (mode == old_mode || mode == MTR_LOG_SHORT_INSERTS) { if (mode == old_mode || mode == MTR_LOG_SHORT_INSERTS) {
/* Keep MTR_LOG_NONE. */ /* Keep MTR_LOG_NONE. */
...@@ -214,12 +210,10 @@ mtr_t::set_log_mode(mtr_log_t mode) ...@@ -214,12 +210,10 @@ mtr_t::set_log_mode(mtr_log_t mode)
} }
/* fall through */ /* fall through */
case MTR_LOG_SHORT_INSERTS: case MTR_LOG_SHORT_INSERTS:
ut_ad(mode == MTR_LOG_ALL); ut_ad(mode == MTR_LOG_ALL || mode == MTR_LOG_NO_REDO);
/* fall through */ /* fall through */
case MTR_LOG_NO_REDO:
case MTR_LOG_ALL: 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; m_log_mode = mode;
return(old_mode); return(old_mode);
} }
......
...@@ -2267,7 +2267,7 @@ void recv_recover_page(buf_page_t* bpage) ...@@ -2267,7 +2267,7 @@ void recv_recover_page(buf_page_t* bpage)
{ {
mtr_t mtr; mtr_t mtr;
mtr.start(); 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); ut_ad(buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE);
buf_block_t* block = reinterpret_cast<buf_block_t*>(bpage); 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, ...@@ -2385,7 +2385,7 @@ static buf_block_t* recv_recovery_create_page_low(const page_id_t page_id,
goto init_fail; goto init_fail;
mtr.start(); 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), buf_block_t* block = buf_page_create(page_id, page_size_t(space->flags),
&mtr); &mtr);
if (recv_addr->state == RECV_PROCESSED) if (recv_addr->state == RECV_PROCESSED)
...@@ -2511,7 +2511,7 @@ void recv_apply_hashed_log_recs(bool last_batch) ...@@ -2511,7 +2511,7 @@ void recv_apply_hashed_log_recs(bool last_batch)
if (recv_addr->state == RECV_NOT_PROCESSED) { if (recv_addr->state == RECV_NOT_PROCESSED) {
apply: apply:
mtr.start(); 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( if (buf_block_t* block = buf_page_get_low(
page_id, univ_page_size, page_id, univ_page_size,
RW_X_LATCH, NULL, RW_X_LATCH, NULL,
......
...@@ -1006,7 +1006,7 @@ struct FindModifiedSpacePage ...@@ -1006,7 +1006,7 @@ struct FindModifiedSpacePage
void mtr_t::memo_modify_page(ulint space, ulint page) 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; return;
Iterate<FindModifiedSpacePage> iteration( Iterate<FindModifiedSpacePage> iteration(
(FindModifiedSpacePage(space, page))); (FindModifiedSpacePage(space, page)));
...@@ -1045,7 +1045,7 @@ struct FindModifiedPtr ...@@ -1045,7 +1045,7 @@ struct FindModifiedPtr
@param[in] ptr pointer to within buffer frame */ @param[in] ptr pointer to within buffer frame */
void mtr_t::memo_modify_page(const byte *ptr) void mtr_t::memo_modify_page(const byte *ptr)
{ {
if (m_memo.empty()) if (m_log_mode == MTR_LOG_NONE || m_memo.empty())
return; return;
Iterate<FindModifiedPtr> iteration((FindModifiedPtr(ptr))); 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