mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
c1d7b4575e
The InnoDB DATA DIRECTORY attribute is not implemented via symbolic links but something similar, *.isl files that contain the names of data files. InnoDB failed to ignore the DATA DIRECTORY attribute even though the server was started with --skip-symbolic-links. Native ALTER TABLE in InnoDB will retain the DATA DIRECTORY attribute of the table, no matter if the table will be rebuilt or not. Generic ALTER TABLE (with ALGORITHM=COPY) as well as TRUNCATE TABLE will discard the DATA DIRECTORY attribute. All tests have been run with and without the ./mtr option --mysqld=--skip-symbolic-links and some tests that use the InnoDB DATA DIRECTORY attribute have been adjusted for this.
104 lines
3.6 KiB
Text
104 lines
3.6 KiB
Text
--source include/have_innodb.inc
|
|
--source include/have_partition.inc
|
|
--source include/have_symlink.inc
|
|
|
|
--echo #
|
|
--echo # MDEV-15953 Alter InnoDB Partitioned Table Moves Files (which were originally not in the datadir) to the datadir
|
|
--echo #
|
|
|
|
mkdir $MYSQLTEST_VARDIR/tmp/partitions_here;
|
|
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
eval CREATE TABLE t (
|
|
a INT NOT NULL
|
|
) ENGINE=INNODB
|
|
PARTITION BY HASH (a) (
|
|
PARTITION p1 DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_here/' ENGINE = INNODB,
|
|
PARTITION p2 DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_here/' ENGINE = INNODB
|
|
);
|
|
INSERT INTO t VALUES (1);
|
|
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
SHOW CREATE TABLE t;
|
|
ALTER TABLE t ADD PRIMARY KEY pk(a), ALGORITHM=INPLACE;
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
SHOW CREATE TABLE t;
|
|
ALTER TABLE t DROP PRIMARY KEY, ALGORITHM=COPY;
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
SHOW CREATE TABLE t;
|
|
SET @TMP = @@GLOBAL.INNODB_FILE_PER_TABLE;
|
|
SET GLOBAL INNODB_FILE_PER_TABLE=OFF;
|
|
ALTER TABLE t ADD PRIMARY KEY pk(a), ALGORITHM=INPLACE;
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
SHOW CREATE TABLE t;
|
|
SET GLOBAL INNODB_FILE_PER_TABLE=@TMP;
|
|
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
eval ALTER TABLE t REORGANIZE PARTITION p1,p2 INTO (
|
|
PARTITION p1 DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB,
|
|
PARTITION p2 DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB
|
|
);
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
SHOW CREATE TABLE t;
|
|
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
eval ALTER TABLE t REORGANIZE PARTITION p1,p2 INTO (
|
|
PARTITION p1 DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/',
|
|
PARTITION p2 DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/'
|
|
);
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
SHOW CREATE TABLE t;
|
|
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
eval ALTER TABLE t REORGANIZE PARTITION p1,p2 INTO (
|
|
PARTITION p1 INDEX DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB,
|
|
PARTITION p2 INDEX DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB
|
|
);
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
SHOW CREATE TABLE t;
|
|
|
|
DROP TABLE t;
|
|
|
|
SET @strict = @@innodb_strict_mode;
|
|
SET innodb_strict_mode=OFF;
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
eval CREATE TABLE t (
|
|
a INT NOT NULL
|
|
) ENGINE=INNODB
|
|
PARTITION BY RANGE (a)
|
|
SUBPARTITION BY HASH (a)
|
|
SUBPARTITIONS 2
|
|
(
|
|
PARTITION p1 VALUES LESS THAN (7)
|
|
DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_here/'
|
|
INDEX DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_here/'
|
|
ENGINE = INNODB,
|
|
PARTITION p2 VALUES LESS THAN MAXVALUE
|
|
DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_here/'
|
|
INDEX DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_here/'
|
|
ENGINE = INNODB
|
|
);
|
|
SET innodb_strict_mode=@strict;
|
|
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
eval ALTER TABLE t
|
|
REORGANIZE PARTITION p1,p2 INTO
|
|
(
|
|
PARTITION p1 VALUES LESS THAN (7)
|
|
DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/'
|
|
INDEX DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/'
|
|
ENGINE = INNODB,
|
|
PARTITION p2 VALUES LESS THAN MAXVALUE
|
|
DATA DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/'
|
|
INDEX DIRECTORY = '$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/'
|
|
ENGINE = INNODB
|
|
);
|
|
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
SHOW CREATE TABLE t;
|
|
|
|
DROP TABLE t;
|
|
|
|
rmdir $MYSQLTEST_VARDIR/tmp/partitions_here/test;
|
|
rmdir $MYSQLTEST_VARDIR/tmp/partitions_here;
|
|
|