From 15f09a11a49ec61bfd011f06e4c9afb761d2c371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 17 Jun 2026 08:43:10 +0300 Subject: [PATCH] MDEV-40070 innodb_log_archive multi-batch recovery crash recv_sys_t::parse_mmap(): When the current mini-transaction spans two log files and we run out of memory while attempting to store the parsed records into recv_sys.pages, the next log file would already have been closed by recv_sys_t::rewind(). Handle this condition specially. --- storage/innobase/log/log0recv.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 4b0f880459d91..72b62c36d6a15 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -3887,7 +3887,12 @@ recv_sys_t::parse_mtr_result recv_sys_t::parse_mmap(bool if_exists) } recv_warp s{&log_sys.buf[recv_sys.offset]}; auto r= recv_sys.parse(s,if_exists); - log_sys.archived_mmap_switch_recovery_complete(); + if (UNIV_LIKELY(r != GOT_OOM)) + log_sys.archived_mmap_switch_recovery_complete(); + else + /* rewind() must have closed the next file when invoking + log_sys.set_recovered_lsn(start_lsn) */ + ut_ad(!log_sys.archived_mmap_switch()); return r; } recv_ring s