summaryrefslogtreecommitdiff
path: root/extra/mariabackup/xtrabackup.h
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-06-17 13:46:16 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-06-17 13:46:16 +0300
commitf778a5d5e2aaff7c58000f9e2423a809db14747c (patch)
treed2c943a8565f9b9f2b74aec6289801c1b383089b /extra/mariabackup/xtrabackup.h
parente95f78f4752e4c0433e969f34e01b4b6be39efa1 (diff)
downloadmariadb-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/xtrabackup.h')
-rw-r--r--extra/mariabackup/xtrabackup.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/extra/mariabackup/xtrabackup.h b/extra/mariabackup/xtrabackup.h
index 0d1d3eb5a6b..37cc54e5abb 100644
--- a/extra/mariabackup/xtrabackup.h
+++ b/extra/mariabackup/xtrabackup.h
@@ -284,4 +284,16 @@ fil_file_readdir_next_file(
os_file_dir_t dir, /*!< in: directory stream */
os_file_stat_t* info); /*!< in/out: buffer where the
info is returned */
+
+#ifndef DBUG_OFF
+#include <fil0fil.h>
+extern void dbug_mariabackup_event(const char *event,
+ const fil_space_t::name_type key);
+
+#define DBUG_MARIABACKUP_EVENT(A, B) \
+ DBUG_EXECUTE_IF("mariabackup_events", dbug_mariabackup_event(A, B);)
+#else
+#define DBUG_MARIABACKUP_EVENT(A, B) /* empty */
+#endif // DBUG_OFF
+
#endif /* XB_XTRABACKUP_H */