Commit 406ca20b authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-22108 Recovery fails with InnoDB: Malformed log record

mtr_t::log_write(): Fix an off-by-one error.
parent e8351934
...@@ -427,7 +427,7 @@ inline byte *mtr_t::log_write(const page_id_t id, const buf_page_t *bpage, ...@@ -427,7 +427,7 @@ inline byte *mtr_t::log_write(const page_id_t id, const buf_page_t *bpage,
if (oend + len > &log_ptr[16]) if (oend + len > &log_ptr[16])
{ {
len+= oend - log_ptr - 15; len+= oend - log_ptr - 15;
if (len >= MIN_3BYTE) if (len >= MIN_3BYTE - 1)
len+= 2; len+= 2;
else if (len >= MIN_2BYTE) else if (len >= MIN_2BYTE)
len++; len++;
...@@ -448,7 +448,7 @@ inline byte *mtr_t::log_write(const page_id_t id, const buf_page_t *bpage, ...@@ -448,7 +448,7 @@ inline byte *mtr_t::log_write(const page_id_t id, const buf_page_t *bpage,
else if (len >= 3 && end + len > &log_ptr[16]) else if (len >= 3 && end + len > &log_ptr[16])
{ {
len+= end - log_ptr - 15; len+= end - log_ptr - 15;
if (len >= MIN_3BYTE) if (len >= MIN_3BYTE - 1)
len+= 2; len+= 2;
else if (len >= MIN_2BYTE) else if (len >= MIN_2BYTE)
len++; 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