Skip to content

Conversation

@dr-m
Copy link
Contributor

@dr-m dr-m commented Oct 28, 2025

  • The Jira issue number for this PR is: MDEV-37949

Description

TODO: fill description here

Release Notes

TODO: What should the release notes say about this change?

How can this PR be tested?

TODO: modify the automated test suite to verify that the PR causes MariaDB to behave as intended.

Basing the PR against the correct MariaDB version

  • This is a new feature or a refactoring, and the PR is based against the main branch.
  • This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.

This is a new feature, but for now based on the 11.4 branch so that any unrelated errors that may be found during testing can be fixed rather quickly. Merges to the main branch may be blocked for weeks at a time.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

@dr-m dr-m self-assigned this Oct 28, 2025
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@dr-m dr-m force-pushed the MDEV-37949 branch 2 times, most recently from 99fbd9a to 6da834f Compare November 10, 2025 14:35
dr-m added 2 commits November 12, 2025 13:59
…target

innodb_log_recovery_start: The checkpoint LSN to start recovery from.
This will be useful when recovering from an archived log.

innodb_log_recovery_target: The requested LSN to end recovery at.
This will be useful when recovering data files that were copied
as of a time that is before end of the available log.
The new setting SET GLOBAL innodb_log_archive=ON will enable log
archiving as soon as the current ib_logfile0 is about to wrap around
an odd number of times.

The new status variable innodb_lsn_archived will return 0 when log
archiving is not enabled, or a LSN since when a complete InnoDB log
archive is available.

When innodb_log_archive=ON, the setting SET GLOBAL innodb_log_file_size
will affect subsequently created log files when the file that is being
currently written is running out.

log_t::archive_new_write(): Create and allocate a new log file,
and write the outstanding data to both the current and the new file.

log_t::archive_new_mmap(): Create and memory-map a new log file,
and update file_size to resize_target.

log_t::archive_set_size(): Ensure that resize_target is set for
new archived log files.

log_write_buf(): Add the parameter max_length, the file wrap limit.

mtr_t::finish_writer(): Specialize for innodb_log_archive=ON

TODO: Rename log files and set innodb_lsn_archived on checkpoint.

TODO: Implement recovery from archived log.
dr-m added 3 commits November 14, 2025 15:11
NOTE! innodb_log_archive=ON writes will not work yet!

innodb_log_archive_update(): Assign log_sys.archived_lsn to the latest
checkpoint; it should be usable. If the log buffer is about to wrap
around, back off and retry.

log_t::first_lsn: This should be the start of the current log file,
to be consulted in log_t::write_checkpoint() when renaming files.

log_t::append_prepare_archived_mmap(): Create and memory-map a new log
file. TODO: Do we need a separate function from append_prepare_wait()?

log_t::append_prepare<log_t::ARCHIVED_MMAP>(): Special case.

log_t::archive_new_mmap(): Switch to the buffer that was created in
append_prepare_archived_mmap().
mtr_t::finish_writer(): Invoke log_close() only if innodb_log_archive=OFF.

log_t::append_prepare_archived_mmap(): Simplify a bit, and try to ensure
that a checkpoint will be completed inside the new log file. Still
does not work!
Fix the ARCHIVED_MMAP write path, except for renaming files at
log checkpoint, and implementing crash recovery.

log_t::archived_mmap_switch_complete(): Attempt to complete
log_t::archived_mmap_switch_prepare().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants