MDEV-39770 log_t::persist(): Assertion is_opened() == archive failed#5131
Conversation
|
|
There was a problem hiding this comment.
Code Review
This pull request updates the InnoDB log persistence logic to delay certain assertions until after checking if the log has already been flushed, and adds test coverage for innodb_log_archive. The reviewer suggested optimizing the early return condition in log_t::persist from old > lsn to old >= lsn to avoid redundant 0-byte write operations when the log is already flushed up to the requested LSN.
| if (old > lsn) | ||
| return; |
There was a problem hiding this comment.
There was a problem hiding this comment.
This is a valid comment. However, it is a separate issue and should probably be fixed in the earliest applicable branch (10.11).
There was a problem hiding this comment.
It turns out that this change was intentionally made in #4405. If I reverted that change as suggested, we would get assertion failures in innodb.log_archive,mmap shutdown like this:
mariadbd: /mariadb/main/storage/innobase/mtr/mtr0mtr.cc:1317: static void log_t::append(byte*&, const void*, size_t): Assertion `log_sys.is_mmap() ? ((d >= log_sys.buf && d + size <= log_sys.buf + log_sys.file_size) || (log_sys.archive && d >= log_sys.resize_buf && d + size <= log_sys.resize_buf + log_sys.resize_target)) : (d >= log_sys.buf && d + size <= log_sys.buf + log_sys.buf_size)' failed.
I filed MDEV-39781 to capture this.
log_t::persist(): Move a debug assertion after the point that we are actually about to write to the log. For crash recovery, this function may be invoked in such a way that log_sys.archive disagrees with the format of the log file. Reviewed by: Thirunarayanan Balathandayuthapani
log_t::persist(): Move a debug assertion after the point that we are actually about to write to the log. For crash recovery, this function may be invoked in such a way thatlog_sys.archivedisagrees with the format of the log file.This fixes a regression that was introduced in #4405.