Commit 40bae98c authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-12108 Fix backup for Innodb tables with DATA DIRECTORY

parent 56911096
CREATE TABLE t(a INT) ENGINE=InnoDB DATA DIRECTORY='table_data_dir';
INSERT INTO t VALUES(1);
# xtrabackup backup
# xtrabackup prepare
DROP TABLE t;
# shutdown server
# remove datadir
# xtrabackup move back
# restart server
SELECT * FROM t;
a
1
DROP TABLE t;
let $table_data_dir=$MYSQLTEST_VARDIR/ddir;
mkdir $table_data_dir;
--replace_result $table_data_dir table_data_dir
EVAL CREATE TABLE t(a INT) ENGINE=InnoDB DATA DIRECTORY='$table_data_dir';
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
--source include/shutdown_mysqld.inc
echo # xtrabackup prepare;
--disable_result_log
exec $XTRABACKUP --prepare --target-dir=$targetdir;
--source include/start_mysqld.inc
DROP TABLE t;
rmdir $table_data_dir;
-- source include/restart_and_restore.inc
--enable_result_log
SELECT * FROM t;
DROP TABLE t;
rmdir $targetdir;
rmdir $table_data_dir;
--partition
\ No newline at end of file
CREATE TABLE t(i int)
ENGINE=InnoDB
PARTITION BY RANGE (i)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION P1 VALUES LESS THAN (200),
PARTITION p2 VALUES LESS THAN (300) DATA DIRECTORY = "D:/work/10.1/xxx/mysql-test/var/partitdata",
PARTITION p3 VALUES LESS THAN (400) DATA DIRECTORY = "D:/work/10.1/xxx/mysql-test/var/partitdata",
PARTITION p4 VALUES LESS THAN MAXVALUE);
INSERT INTO t VALUES (1), (101), (201), (301), (401);
DROP TABLE t;
# shutdown server
# remove datadir
# xtrabackup move back
# restart server
SELECT * FROM t;
i
1
101
201
301
401
DROP TABLE t;
let $targetdir=$MYSQLTEST_VARDIR/backup;
mkdir $targetdir;
mkdir $MYSQLTEST_VARDIR/partitdata;
eval CREATE TABLE t(i int)
ENGINE=InnoDB
PARTITION BY RANGE (i)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION P1 VALUES LESS THAN (200),
PARTITION p2 VALUES LESS THAN (300) DATA DIRECTORY = "$MYSQLTEST_VARDIR/partitdata",
PARTITION p3 VALUES LESS THAN (400) DATA DIRECTORY = "$MYSQLTEST_VARDIR/partitdata",
PARTITION p4 VALUES LESS THAN MAXVALUE);
INSERT INTO t VALUES (1), (101), (201), (301), (401);
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
exec $XTRABACKUP --prepare --target-dir=$targetdir;
DROP TABLE t;
rmdir $MYSQLTEST_VARDIR/partitdata;
--source include/restart_and_restore.inc
--enable_result_log
SELECT * FROM t;
DROP TABLE t;
rmdir $targetdir;
rmdir $MYSQLTEST_VARDIR/partitdata;
...@@ -4857,7 +4857,7 @@ fil_load_single_table_tablespace( ...@@ -4857,7 +4857,7 @@ fil_load_single_table_tablespace(
/* Check for a link file which locates a remote tablespace. */ /* Check for a link file which locates a remote tablespace. */
remote.success = fil_open_linked_file( remote.success = (IS_XTRABACKUP() && !srv_backup_mode) ? 0 : fil_open_linked_file(
tablename, &remote.filepath, &remote.file, FALSE); tablename, &remote.filepath, &remote.file, FALSE);
/* Read the first page of the remote tablespace */ /* Read the first page of the remote tablespace */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment