summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2018-06-22 15:24:09 +0100
committerVladislav Vaintroub <wlad@mariadb.com>2018-06-22 15:24:09 +0100
commitecc4682672f604bf24edb79662ba0eafdfd16f0c (patch)
tree6ef427714379a60b760b0039329531fc043974c7 /mysql-test
parent0d745343fc1e274a938bef9e91b18c508076ae62 (diff)
downloadmariadb-git-ecc4682672f604bf24edb79662ba0eafdfd16f0c.tar.gz
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 <table_name> 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.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/suite/mariabackup/rename_during_mdl_lock.result3
-rw-r--r--mysql-test/suite/mariabackup/rename_during_mdl_lock.test13
2 files changed, 16 insertions, 0 deletions
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;