From ecc4682672f604bf24edb79662ba0eafdfd16f0c Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 22 Jun 2018 15:24:09 +0100 Subject: MDEV-16519 : mariabackup should fail if MDL could not be acquired with lock-ddl-per-table There is a tiny chance for race condition during MDL acquisition. If table is renamed just prior to SELECT 1 FROM LIMIT 0 then this query would fail, yet mariabackup --backup does not handle it as fatal error and continues, only to fail later during file copy. The fix is to die on error, of MDL lock query fails. --- mysql-test/suite/mariabackup/rename_during_mdl_lock.result | 3 +++ mysql-test/suite/mariabackup/rename_during_mdl_lock.test | 13 +++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 mysql-test/suite/mariabackup/rename_during_mdl_lock.result create mode 100644 mysql-test/suite/mariabackup/rename_during_mdl_lock.test (limited to 'mysql-test') diff --git a/mysql-test/suite/mariabackup/rename_during_mdl_lock.result b/mysql-test/suite/mariabackup/rename_during_mdl_lock.result new file mode 100644 index 00000000000..982851438f2 --- /dev/null +++ b/mysql-test/suite/mariabackup/rename_during_mdl_lock.result @@ -0,0 +1,3 @@ +CREATE TABLE t1(i int) ENGINE INNODB; +FOUND 1 /failed to execute query SELECT 1 FROM/ in backup.log +DROP TABLE t2; diff --git a/mysql-test/suite/mariabackup/rename_during_mdl_lock.test b/mysql-test/suite/mariabackup/rename_during_mdl_lock.test new file mode 100644 index 00000000000..0a41f1dfe74 --- /dev/null +++ b/mysql-test/suite/mariabackup/rename_during_mdl_lock.test @@ -0,0 +1,13 @@ +--source include/have_debug.inc +let $targetdir=$MYSQLTEST_VARDIR/backup; +mkdir $targetdir; +CREATE TABLE t1(i int) ENGINE INNODB; +--error 1 +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --lock-ddl-per-table --dbug=+d,rename_during_mdl_lock_table 2>$targetdir/backup.log; + +let SEARCH_FILE=$targetdir/backup.log; +let SEARCH_PATTERN=failed to execute query SELECT 1 FROM; +source include/search_pattern_in_file.inc; + +DROP TABLE t2; +rmdir $targetdir; -- cgit v1.2.1