Commit 4c343394 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-33946: OPT_PAGE_CHECKSUM mismatch due to mtr_t::memmove()

mtr_t::memmove(): Revert to the parent of
commit a032f14b
where there was supposed to be an equivalent change
that would avoid hitting a warning in some old version of GCC
when this change was part of another 10.6 based developmet branch.

For some reason, this change is not equivalent but will cause
massive amounts of backup failures in the stress tests
run by Matthias Leich, caught by
commit 4179f93d in 10.6.
parent 2e84560d
...@@ -347,12 +347,11 @@ inline void mtr_t::memmove(const buf_block_t &b, ulint d, ulint s, ulint len) ...@@ -347,12 +347,11 @@ inline void mtr_t::memmove(const buf_block_t &b, ulint d, ulint s, ulint len)
ut_ad(d >= 8); ut_ad(d >= 8);
ut_ad(s >= 8); ut_ad(s >= 8);
ut_ad(len); ut_ad(len);
ut_d(const ulint ps= srv_page_size); ut_ad(s <= ulint(srv_page_size));
ut_ad(s <= ps); ut_ad(s + len <= ulint(srv_page_size));
ut_ad(s + len <= ps);
ut_ad(s != d); ut_ad(s != d);
ut_ad(d <= ps); ut_ad(d <= ulint(srv_page_size));
ut_ad(d + len <= ps); ut_ad(d + len <= ulint(srv_page_size));
set_modified(b); set_modified(b);
if (m_log_mode != MTR_LOG_ALL) if (m_log_mode != MTR_LOG_ALL)
...@@ -360,17 +359,17 @@ inline void mtr_t::memmove(const buf_block_t &b, ulint d, ulint s, ulint len) ...@@ -360,17 +359,17 @@ inline void mtr_t::memmove(const buf_block_t &b, ulint d, ulint s, ulint len)
static_assert(MIN_4BYTE > UNIV_PAGE_SIZE_MAX, "consistency"); static_assert(MIN_4BYTE > UNIV_PAGE_SIZE_MAX, "consistency");
size_t lenlen= (len < MIN_2BYTE ? 1 : len < MIN_3BYTE ? 2 : 3); size_t lenlen= (len < MIN_2BYTE ? 1 : len < MIN_3BYTE ? 2 : 3);
/* The source offset is encoded relative to the destination offset, /* The source offset is encoded relative to the destination offset,
with the sign in the least significant bit. with the sign in the least significant bit. */
Because the source offset 0 is not possible, our encoding if (s > d)
subtracts 1 from the offset. */ s= (s - d) << 1;
const uint16_t S= s > d else
? uint16_t((s - d - 1) << 1) s= (d - s) << 1 | 1;
: uint16_t((d - s - 1) << 1 | 1);
/* The source offset 0 is not possible. */ /* The source offset 0 is not possible. */
size_t slen= (S < MIN_2BYTE ? 1 : S < MIN_3BYTE ? 2 : 3); s-= 1 << 1;
size_t slen= (s < MIN_2BYTE ? 1 : s < MIN_3BYTE ? 2 : 3);
byte *l= log_write<MEMMOVE>(b.page.id(), &b.page, lenlen + slen, true, d); byte *l= log_write<MEMMOVE>(b.page.id(), &b.page, lenlen + slen, true, d);
l= mlog_encode_varint(l, len); l= mlog_encode_varint(l, len);
l= mlog_encode_varint(l, S); l= mlog_encode_varint(l, s);
m_log.close(l); m_log.close(l);
m_last_offset= static_cast<uint16_t>(d + len); m_last_offset= static_cast<uint16_t>(d + len);
} }
......
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