Commit 8760fe11 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-31791: Recovery on memory-mapped log occasionally fails

recv_ring::copy_if_needed(): If the record wraps around the
memory-mapped ib_logfile0, do copy it also if len==0
(the record consists only of a header, like FREE_PAGE and INIT_PAGE
records do).

recv_sys_t::parse(): Invoke recv_ring::copy_if_needed() for INIT_PAGE
and FREE_PAGE records, so that if these records wrap around the
memory-mapped ib_logfile0, they will be correctly copied to
recv_sys.pages.

Together with commit 0d175968 (MDEV-31354)
this fixes occasional failures of the test innodb.recovery_memory.
parent 941af1fa
......@@ -2395,8 +2395,6 @@ struct recv_ring : public recv_buf
const byte *copy_if_needed(const byte *iv, byte *tmp, recv_ring start,
size_t len)
{
if (!len)
return ptr;
const size_t s(*this - start);
ut_ad(s + len <= srv_page_size);
if (!log_sys.is_encrypted())
......@@ -2751,6 +2749,8 @@ recv_sys_t::parse_mtr_result recv_sys_t::parse(source &l, bool if_exists)
store_freed_or_init_rec(id, (b & 0x70) == FREE_PAGE);
if (UNIV_UNLIKELY(rlen != 0))
goto record_corrupted;
copy_if_needed:
cl= l.copy_if_needed(iv, decrypt_buf, recs, rlen);
break;
case EXTENDED:
if (UNIV_UNLIKELY(!rlen))
......@@ -2782,10 +2782,7 @@ recv_sys_t::parse_mtr_result recv_sys_t::parse(source &l, bool if_exists)
break;
case OPTION:
if (rlen == 5 && *l == OPT_PAGE_CHECKSUM)
{
cl= l.copy_if_needed(iv, decrypt_buf, recs, rlen);
break;
}
goto copy_if_needed;
/* fall through */
case RESERVED:
continue;
......
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