Skip to content

Commit

Permalink
MDEV-33946: OPT_PAGE_CHECKSUM mismatch due to mtr_t::memmove()
Browse files Browse the repository at this point in the history
mtr_t::memmove(): Revert to the parent of
commit a032f14
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 4179f93 in 10.6.
  • Loading branch information
dr-m committed Apr 19, 2024
1 parent 2e84560 commit 4c34339
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions storage/innobase/include/mtr0log.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,30 +347,29 @@ inline void mtr_t::memmove(const buf_block_t &b, ulint d, ulint s, ulint len)
ut_ad(d >= 8);
ut_ad(s >= 8);
ut_ad(len);
ut_d(const ulint ps= srv_page_size);
ut_ad(s <= ps);
ut_ad(s + len <= ps);
ut_ad(s <= ulint(srv_page_size));
ut_ad(s + len <= ulint(srv_page_size));
ut_ad(s != d);
ut_ad(d <= ps);
ut_ad(d + len <= ps);
ut_ad(d <= ulint(srv_page_size));
ut_ad(d + len <= ulint(srv_page_size));

set_modified(b);
if (m_log_mode != MTR_LOG_ALL)
return;
static_assert(MIN_4BYTE > UNIV_PAGE_SIZE_MAX, "consistency");
size_t lenlen= (len < MIN_2BYTE ? 1 : len < MIN_3BYTE ? 2 : 3);
/* The source offset is encoded relative to the destination offset,
with the sign in the least significant bit.
Because the source offset 0 is not possible, our encoding
subtracts 1 from the offset. */
const uint16_t S= s > d
? uint16_t((s - d - 1) << 1)
: uint16_t((d - s - 1) << 1 | 1);
with the sign in the least significant bit. */
if (s > d)
s= (s - d) << 1;
else
s= (d - s) << 1 | 1;
/* 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);
l= mlog_encode_varint(l, len);
l= mlog_encode_varint(l, S);
l= mlog_encode_varint(l, s);
m_log.close(l);
m_last_offset= static_cast<uint16_t>(d + len);
}
Expand Down

0 comments on commit 4c34339

Please sign in to comment.