Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-25854

Restoring a backup may result in garbage intermediate tables from DDL




      MDEV-17567 and MDEV-25180 changed something in InnoDB startup. We forgot to adjust Mariabackup accordingly.

      Specifically, the command mariabackup --prepare --export is supposed to purge the history of old transactions, and also apply all logs.

      Starting with MDEV-25180, InnoDB no longer treats specially any tables whose names start with #sql. The only exception are table names that start with #sql-ib. It is the responsibility of the SQL layer's DDL log recovery to drop any such tables, in case the server was killed (or a backup was made) while a table-rebuilding DDL operation was in progress.

      The following patch proves that a regression was introduced. If the function (which would start the InnoDB purge of transaction history) would be invoked during mariabackup --prepare --export, the execution would be aborted due to assertion failure.

      diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
      index db5c8524776..73f7a1aa248 100644
      --- a/storage/innobase/handler/ha_innodb.cc
      +++ b/storage/innobase/handler/ha_innodb.cc
      @@ -1954,6 +1954,7 @@ static int innodb_check_version(handlerton *hton, const char *path,
       static void innodb_ddl_recovery_done(handlerton*)
      +  ut_a(srv_operation != SRV_OPERATION_RESTORE_EXPORT);
         ut_d(ddl_recovery_done= true);
         if (!srv_read_only_mode && srv_operation == SRV_OPERATION_NORMAL &&
             srv_force_recovery < SRV_FORCE_NO_BACKGROUND)

      We must ensure that ha_signal_ddl_recovery_done() will be invoked. Should it for some reason be unacceptable to invoke ddl_log_execute_recovery() in mariabackup --prepare --export, then we would have to invoke special code that would drop all #sql- tables from InnoDB, before executing ha_signal_ddl_recovery_done(). In any case, we must somehow compensate for the change that was made in MDEV-25666.

      Note: Nothing must change in mariabackup outside --prepare --export. We do not want to ruin incremental backups by executing actions that would generate InnoDB redo log records.


        Issue Links



              marko Marko Mäkelä
              marko Marko Mäkelä
              0 Vote for this issue
              4 Start watching this issue



                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.