diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-06-17 13:46:16 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-06-17 13:46:16 +0300 |
commit | f778a5d5e2aaff7c58000f9e2423a809db14747c (patch) | |
tree | d2c943a8565f9b9f2b74aec6289801c1b383089b /extra/mariabackup/backup_mysql.cc | |
parent | e95f78f4752e4c0433e969f34e01b4b6be39efa1 (diff) | |
download | mariadb-git-f778a5d5e2aaff7c58000f9e2423a809db14747c.tar.gz |
MDEV-25854: Remove garbage tables after restoring a backup
In commit 1c5ae9919463ee0fc1d65fdfc7ec39534495ecaf (MDEV-25666)
we had changed Mariabackup so that it would no longer skip files
whose names start with #sql. This turned out to be wrong.
Because operations on such named files are not protected by any
locks in the server, it is not safe to copy them.
Not copying the files may make the InnoDB data dictionary
inconsistent with the file system. So, we must do something
in InnoDB to adjust for that.
If InnoDB is being started up without the redo log (ib_logfile0)
or with a zero-length log file, we will assume that the server
was restored from a backup, and adjust things as follows:
dict_check_sys_tables(), fil_ibd_open(): Do not complain about
missing #sql files if they would be dropped a little later.
dict_stats_update_if_needed(): Never add #sql tables to
the recomputing queue. This avoids a potential race condition when
dropping the garbage tables.
drop_garbage_tables_after_restore(): Try to drop any garbage tables.
innodb_ddl_recovery_done(): Invoke drop_garbage_tables_after_restore()
if srv_start_after_restore (a new flag) was set and we are not in
read-only mode (innodb_read_only=ON or innodb_force_recovery>3).
The tests and dbug_mariabackup_event() instrumentation
were developed by Vladislav Vaintroub, who also reviewed this.
Diffstat (limited to 'extra/mariabackup/backup_mysql.cc')
-rw-r--r-- | extra/mariabackup/backup_mysql.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index e1afbf6f99b..f287af82e6f 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -921,9 +921,11 @@ bool lock_tables(MYSQL *connection) } xb_mysql_query(connection, "BACKUP STAGE START", true); + DBUG_MARIABACKUP_EVENT("after_backup_stage_start", {}); // xb_mysql_query(connection, "BACKUP STAGE FLUSH", true); // xb_mysql_query(connection, "BACKUP STAGE BLOCK_DDL", true); xb_mysql_query(connection, "BACKUP STAGE BLOCK_COMMIT", true); + DBUG_MARIABACKUP_EVENT("after_backup_stage_block_commit", {}); /* Set the maximum supported session value for lock_wait_timeout to prevent unnecessary timeouts when the global value is changed from the default */ |