From b41e88430d384761dc9f9b0e3b693bc70750b7b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 7 Aug 2026 17:05:09 +0300 Subject: [PATCH] MDEV-40667 Infinite loop on SET GLOBAL innodb_log_archive=ON log_t::set_archive(): Always invoke buf_flush_wait(wait_lsn, false) on the latest sampled get_lsn(), so that if a checkpoint is possible, one will be executed. --- storage/innobase/log/log0log.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index ee8d43a68e500..c8aa06b02dce2 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -811,14 +811,15 @@ void log_t::set_archive(my_bool archive, THD *thd) noexcept if (archive) { - wait_lsn-= (wait_lsn - first_lsn) % capacity(); + const lsn_t limit{wait_lsn - (wait_lsn - first_lsn) % capacity()}; /* We are in innodb_log_archive=OFF. If the file has wrapped around between the checkpoint and the current position, we must wait for a log checkpoint not before the desired first_lsn of our innodb_log_archive=ON log file, because that format does not allow any wrap-around. */ - if (checkpoint < wait_lsn) + if (checkpoint < limit) goto retry_after_checkpoint; + wait_lsn= limit; } else if (circular_recovery_from_sequence_bit_0) {