Visitar URL original
MDEV-41843 Forcing rotation of Aria log files by sanja-byelkin · Pull Request #6135 · MariaDB/server · GitHub
Skip to content

MDEV-41843 Forcing rotation of Aria log files - #6135

Open
sanja-byelkin wants to merge 1 commit into
mainfrom
13.2-MDEV-41843
Open

sanja-byelkin wants to merge 1 commit into
mainfrom
13.2-MDEV-41843

Conversation

@sanja-byelkin

Copy link
Copy Markdown
Member

Backup needs to switch Aria to a new log file so that the finished files can be copied without blocking commits.

Added translog_rotate() and handlerton::rotate_logs (ha_rotate_logs()), implemented for Aria. Nothing in the server calls it yet (BACKUP SERVER will), so it is tested by the unit test ma_test_loghandler_rotate-t.

Rotation of a log without records makes files with no records, which were not handled:

  • the header of such a file got max LSN 0, which purge takes for a file still in writing and never passes; now it gets the last address of the file
  • the scan for the first record (recovery without a checkpoint, aria_read_log) stopped at the filler of the empty file and found no records; now it goes on to the next page
  • the log start left a page of the empty log pinned

Assisted-by: Claude:claude-opus-5-5

Backup needs to switch Aria to a new log file so that the finished
files can be copied without blocking commits.

Added translog_rotate() and handlerton::rotate_logs (ha_rotate_logs()),
implemented for Aria. Nothing in the server calls it yet (BACKUP SERVER
will), so it is tested by the unit test ma_test_loghandler_rotate-t.

Rotation of a log without records makes files with no records, which
were not handled:
- the header of such a file got max LSN 0, which purge takes for a file
  still in writing and never passes; now it gets the last address of
  the file
- the scan for the first record (recovery without a checkpoint,
  aria_read_log) stopped at the filler of the empty file and found no
  records; now it goes on to the next page
- the log start left a page of the empty log pinned

Assisted-by: Claude:claude-opus-5-5
@CLAassistant

Copy link
Copy Markdown

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 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder what this is needed for. The function maria_backup_log_tail() in #4817 is copying the last ENGINE=Aria log file. Disabling the critical part in it by applying the following patch:

diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index c0eb72c8727..c6b526d272c 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -4118,7 +4118,7 @@ static bool maria_backup_log_tail(const backup_target &target,
       my_close(s, MYF(0));
       return true;
     }
-    if (translog_cut_page(buf, end))
+    if (0 && translog_cut_page(buf, end))
     {
       my_error(ER_ERROR_ON_READ, MYF(0), name, HA_ERR_CRASHED);
       goto fail;

would make one test crash on recovery:

CURRENT_TEST: backup.backup_aria_log_end
…
2026-11-12 15:45:09 0 [Note] Plugin 'InnoDB' is disabled.
mariadbd: /mariadb/main/storage/maria/ma_loghandler.c:7195: translog_read_record_header_from_buffer: Assertion `translog_is_LSN_chunk(page[page_offset])' failed.

I believe that this should demonstrate that the log in its present format is being recovered just fine.

Comment thread sql/handler.cc
Comment on lines +3590 to +3594
bool ha_rotate_logs()
{
return plugin_foreach(NULL, rotate_logs_handlerton,
MYSQL_STORAGE_ENGINE_PLUGIN, 0);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be dead code. I don’t see any caller of it. Was an SQL interface to this forgotten? I do not see any SQL test case being added either.

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.

4 participants