summaryrefslogtreecommitdiff
path: root/mysql-test/suite/mariabackup
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2021-03-31 14:23:56 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2021-03-31 14:23:56 +0200
commit08cb5d848314006111b0c379db6a1fce220579aa (patch)
tree4ec72ec98bd35530d8e21924b511d15f87e588ff /mysql-test/suite/mariabackup
parent35ee4aa4e3bf391b7de78b3e95f3e484394fd1ac (diff)
downloadmariadb-git-08cb5d848314006111b0c379db6a1fce220579aa.tar.gz
MDEV-25221 Do not remove source file, if copy_file() fails in mariabackup --move-back
Remove an incompletely copied destination file.
Diffstat (limited to 'mysql-test/suite/mariabackup')
-rw-r--r--mysql-test/suite/mariabackup/error_during_copyback.result9
-rw-r--r--mysql-test/suite/mariabackup/error_during_copyback.test25
2 files changed, 34 insertions, 0 deletions
diff --git a/mysql-test/suite/mariabackup/error_during_copyback.result b/mysql-test/suite/mariabackup/error_during_copyback.result
new file mode 100644
index 00000000000..9b12c1135d2
--- /dev/null
+++ b/mysql-test/suite/mariabackup/error_during_copyback.result
@@ -0,0 +1,9 @@
+CREATE TABLE t(i INT) ENGINE INNODB;
+INSERT INTO t VALUES(1);
+# xtrabackup backup
+# xtrabackup prepare
+# restart server
+SELECT * FROM t;
+i
+1
+DROP TABLE t;
diff --git a/mysql-test/suite/mariabackup/error_during_copyback.test b/mysql-test/suite/mariabackup/error_during_copyback.test
new file mode 100644
index 00000000000..3ec9fbfc3c3
--- /dev/null
+++ b/mysql-test/suite/mariabackup/error_during_copyback.test
@@ -0,0 +1,25 @@
+--source include/have_debug.inc
+CREATE TABLE t(i INT) ENGINE INNODB;
+INSERT INTO t VALUES(1);
+echo # xtrabackup backup;
+let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
+--enable_result_log
+echo # xtrabackup prepare;
+--disable_result_log
+exec $XTRABACKUP --prepare --target-dir=$targetdir;
+let $_datadir= `SELECT @@datadir`;
+--source include/shutdown_mysqld.inc
+rmdir $_datadir;
+error 1;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$_datadir --target-dir=$targetdir --dbug=+d,copy_file_error;
+list_files $_datadir;
+rmdir $_datadir;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$_datadir --target-dir=$targetdir;
+echo # restart server;
+--source include/start_mysqld.inc
+SELECT * FROM t;
+DROP TABLE t;
+rmdir $targetdir;
+