diff options
author | Mattias Jonsson <mattias.jonsson@oracle.com> | 2011-03-31 14:38:54 +0200 |
---|---|---|
committer | Mattias Jonsson <mattias.jonsson@oracle.com> | 2011-03-31 14:38:54 +0200 |
commit | 92c6bc5e1475cf4bc6403fa6c8e98b335af751e1 (patch) | |
tree | 4f0aa0540be333e925a51829dc7b066aec383bd4 | |
parent | d9a3c07396322249da620f578d8bbf6e0a8edc68 (diff) | |
download | mariadb-git-92c6bc5e1475cf4bc6403fa6c8e98b335af751e1.tar.gz |
Backport of bug#11891417 from mysql-trunk to mysql-5.5
-rw-r--r-- | mysql-test/r/partition_error.result | 158 | ||||
-rw-r--r-- | mysql-test/r/partition_myisam.result | 241 | ||||
-rw-r--r-- | mysql-test/r/partition_not_embedded.result | 81 | ||||
-rw-r--r-- | mysql-test/r/partition_symlink.result | 10 | ||||
-rw-r--r-- | mysql-test/t/partition_error.test | 147 | ||||
-rw-r--r-- | mysql-test/t/partition_myisam.test | 173 | ||||
-rw-r--r-- | mysql-test/t/partition_not_embedded.test | 53 | ||||
-rw-r--r-- | mysql-test/t/partition_symlink.test | 11 |
8 files changed, 467 insertions, 407 deletions
diff --git a/mysql-test/r/partition_error.result b/mysql-test/r/partition_error.result index 87eafb234a8..252a6b4386a 100644 --- a/mysql-test/r/partition_error.result +++ b/mysql-test/r/partition_error.result @@ -710,95 +710,8 @@ DROP TABLE t1; CREATE TABLE t1 (c TIMESTAMP) PARTITION BY HASH (c) PARTITIONS 4; ERROR HY000: Field 'c' is of a not allowed type for this type of partitioning +# Moved to partition_myisam, since it was MyISAM specific # Added test with existing TIMESTAMP partitioning (when it was allowed). -CREATE TABLE t1 (a TIMESTAMP) -PARTITION BY HASH (UNIX_TIMESTAMP(a)); -INSERT INTO t1 VALUES ('2000-01-02 03:04:05'); -SELECT * FROM t1; -a -2000-01-02 03:04:05 -FLUSH TABLES; -# replacing t1.frm with TO_DAYS(a) which was allowed earlier. -# Disable warnings, since the result would differ when running with -# --ps-protocol (only for the 'SELECT * FROM t1' statement). -SELECT * FROM t1; -a -2000-01-02 03:04:05 -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (TO_DAYS(a)) */ -INSERT INTO t1 VALUES ('2001-02-03 04:05:06'); -SELECT * FROM t1; -a -2000-01-02 03:04:05 -2001-02-03 04:05:06 -ALTER TABLE t1 ADD PARTITION PARTITIONS 2; -Warnings: -Warning 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed -ALTER TABLE t1 -PARTITION BY RANGE (TO_DAYS(a)) -(PARTITION p0 VALUES LESS THAN (10000), -PARTITION p1 VALUES LESS THAN (MAXVALUE)); -ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (TO_DAYS(a)) -PARTITIONS 3 */ -CREATE TABLE t2 LIKE t1; -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (TO_DAYS(a)) -PARTITIONS 3 */ -Warnings: -Warning 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed -DROP TABLE t2; -CREATE TABLE t2 SELECT * FROM t1; -DROP TABLE t2; -ALTER TABLE t1 PARTITION BY HASH (UNIX_TIMESTAMP(a)); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (UNIX_TIMESTAMP(a)) */ -ALTER TABLE t1 ADD PARTITION PARTITIONS 2; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY HASH (UNIX_TIMESTAMP(a)) -PARTITIONS 3 */ -SELECT * FROM t1; -a -2000-01-02 03:04:05 -2001-02-03 04:05:06 -DROP TABLE t1; -# -# Bug#49161: Out of memory; restart server and try again (needed 2 bytes) -# -CREATE TABLE t1 (a INT) PARTITION BY HASH (a); -FLUSH TABLES; -CHECK TABLE t1; -Table Op Msg_type Msg_text -test.t1 check Error Failed to read from the .par file -test.t1 check Error Incorrect information in file: './test/t1.frm' -test.t1 check error Corrupt -SELECT * FROM t1; -ERROR HY000: Failed to read from the .par file -# Note that it is currently impossible to drop a partitioned table -# without the .par file -DROP TABLE t1; -ERROR 42S02: Unknown table 't1' # # Bug#49477: Assertion `0' failed in ha_partition.cc:5530 # with temporary table and partitions @@ -831,10 +744,10 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL, `purchased` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=<curr_engine> DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(purchased)) SUBPARTITION BY HASH (TO_DAYS(purchased)) -(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ +(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = <curr_engine>) */ DROP TABLE t1; CREATE TABLE t1 (id INT, purchased DATE) PARTITION BY RANGE(YEAR(purchased)) @@ -852,12 +765,12 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL, `purchased` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=<curr_engine> DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(purchased)) SUBPARTITION BY HASH (TO_DAYS(purchased)) (PARTITION p0 VALUES LESS THAN MAXVALUE - (SUBPARTITION sp0 ENGINE = MyISAM, - SUBPARTITION sp1 ENGINE = MyISAM)) */ + (SUBPARTITION sp0 ENGINE = <curr_engine>, + SUBPARTITION sp1 ENGINE = <curr_engine>)) */ DROP TABLE t1; CREATE TABLE t1 (id INT, purchased DATE) PARTITION BY RANGE(YEAR(purchased)) @@ -872,53 +785,11 @@ Table Create Table t1 CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL, `purchased` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=<curr_engine> DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(purchased)) -(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ +(PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = <curr_engine>) */ DROP TABLE t1; SET @@sql_mode= @org_mode; -# -# Bug#50392: insert_id is not reset for partitioned tables -# auto_increment on duplicate entry -CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY); -SET INSERT_ID= 13; -INSERT INTO t1 VALUES (NULL); -SET INSERT_ID= 12; -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -ERROR 23000: Duplicate entry '13' for key 'PRIMARY' -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`a`) -) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1 -INSERT INTO t1 VALUES (NULL); -SELECT * FROM t1; -a -12 -13 -14 -DROP TABLE t1; -CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) PARTITION BY KEY(a); -SET INSERT_ID= 13; -INSERT INTO t1 VALUES (NULL); -SET INSERT_ID= 12; -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -ERROR 23000: Duplicate entry '13' for key 'PRIMARY' -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`a`) -) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1 -/*!50100 PARTITION BY KEY (a) */ -INSERT INTO t1 VALUES (NULL); -SELECT * FROM t1; -a -12 -13 -14 -DROP TABLE t1; CREATE TABLE t1 (a INTEGER NOT NULL, PRIMARY KEY (a)); INSERT INTO t1 VALUES (1),(1); ERROR 23000: Duplicate entry '1' for key 'PRIMARY' @@ -928,19 +799,6 @@ PARTITION BY KEY (a) PARTITIONS 2; INSERT INTO t1 VALUES (1),(1); ERROR 23000: Duplicate entry '1' for key 'PRIMARY' DROP TABLE t1; -CREATE TABLE t1 (a INT) -PARTITION BY HASH (a) -( PARTITION p0 ENGINE=MyISAM, -PARTITION p1); -ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL -CREATE TABLE t1 (a INT) -PARTITION BY LIST (a) -SUBPARTITION BY HASH (a) -( PARTITION p0 VALUES IN (0) -( SUBPARTITION s0, SUBPARTITION s1 ENGINE=MyISAM, SUBPARTITION s2), -PARTITION p1 VALUES IN (1) -( SUBPARTITION s3 ENGINE=MyISAM, SUBPARTITION s4, SUBPARTITION s5 ENGINE=MyISAM)); -ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL CREATE TABLE t1 ( a int ) diff --git a/mysql-test/r/partition_myisam.result b/mysql-test/r/partition_myisam.result new file mode 100644 index 00000000000..57228c8d9a0 --- /dev/null +++ b/mysql-test/r/partition_myisam.result @@ -0,0 +1,241 @@ +DROP TABLE IF EXISTS t1, t2; +# +# Bug#50036: Inconsistent errors when using TIMESTAMP +# columns/expressions +# Added test with existing TIMESTAMP partitioning (when it was allowed). +CREATE TABLE t1 (a TIMESTAMP) +ENGINE = MyISAM +PARTITION BY HASH (UNIX_TIMESTAMP(a)); +INSERT INTO t1 VALUES ('2000-01-02 03:04:05'); +SELECT * FROM t1; +a +2000-01-02 03:04:05 +FLUSH TABLES; +# replacing t1.frm with TO_DAYS(a) which was allowed earlier. +# Disable warnings, since the result would differ when running with +# --ps-protocol (only for the 'SELECT * FROM t1' statement). +SELECT * FROM t1; +a +2000-01-02 03:04:05 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +) ENGINE=<curr_engine> DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY HASH (TO_DAYS(a)) */ +INSERT INTO t1 VALUES ('2001-02-03 04:05:06'); +SELECT * FROM t1; +a +2000-01-02 03:04:05 +2001-02-03 04:05:06 +ALTER TABLE t1 ADD PARTITION PARTITIONS 2; +Warnings: +Warning 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +ALTER TABLE t1 +PARTITION BY RANGE (TO_DAYS(a)) +(PARTITION p0 VALUES LESS THAN (10000), +PARTITION p1 VALUES LESS THAN (MAXVALUE)); +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY HASH (TO_DAYS(a)) +PARTITIONS 3 */ +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY HASH (TO_DAYS(a)) +PARTITIONS 3 */ +Warnings: +Warning 1486 Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +DROP TABLE t2; +CREATE TABLE t2 SELECT * FROM t1; +DROP TABLE t2; +ALTER TABLE t1 PARTITION BY HASH (UNIX_TIMESTAMP(a)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY HASH (UNIX_TIMESTAMP(a)) */ +ALTER TABLE t1 ADD PARTITION PARTITIONS 2; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY HASH (UNIX_TIMESTAMP(a)) +PARTITIONS 3 */ +SELECT * FROM t1; +a +2000-01-02 03:04:05 +2001-02-03 04:05:06 +DROP TABLE t1; +# +# Bug#31931: Mix of handlers error message +# +CREATE TABLE t1 (a INT) +PARTITION BY HASH (a) +( PARTITION p0 ENGINE=MyISAM, +PARTITION p1); +ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL +CREATE TABLE t1 (a INT) +PARTITION BY LIST (a) +SUBPARTITION BY HASH (a) +( PARTITION p0 VALUES IN (0) +( SUBPARTITION s0, SUBPARTITION s1 ENGINE=MyISAM, SUBPARTITION s2), +PARTITION p1 VALUES IN (1) +( SUBPARTITION s3 ENGINE=MyISAM, SUBPARTITION s4, SUBPARTITION s5 ENGINE=MyISAM)); +ERROR HY000: The mix of handlers in the partitions is not allowed in this version of MySQL +# +# Bug#49161: Out of memory; restart server and try again (needed 2 bytes) +# +CREATE TABLE t1 (a INT) +ENGINE = MyISAM +PARTITION BY HASH (a); +FLUSH TABLES; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check Error Failed to read from the .par file +test.t1 check Error Incorrect information in file: './test/t1.frm' +test.t1 check error Corrupt +SELECT * FROM t1; +ERROR HY000: Failed to read from the .par file +# Note that it is currently impossible to drop a partitioned table +# without the .par file +DROP TABLE t1; +ERROR 42S02: Unknown table 't1' +# +# Bug#50392: insert_id is not reset for partitioned tables +# auto_increment on duplicate entry +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) +ENGINE = MyISAM; +SET INSERT_ID= 13; +INSERT INTO t1 VALUES (NULL); +SET INSERT_ID= 12; +# For transactional engines, 12 will not be inserted, since the failing +# statement is rolled back. +INSERT INTO t1 VALUES (NULL), (NULL), (NULL); +ERROR 23000: Duplicate entry '13' for key 'PRIMARY' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1 +INSERT INTO t1 VALUES (NULL); +# NOTE: 12 exists only in non transactional engines! +SELECT * FROM t1; +a +12 +13 +14 +DROP TABLE t1; +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) +ENGINE = MyISAM +PARTITION BY KEY(a); +SET INSERT_ID= 13; +INSERT INTO t1 VALUES (NULL); +SET INSERT_ID= 12; +INSERT INTO t1 VALUES (NULL), (NULL), (NULL); +ERROR 23000: Duplicate entry '13' for key 'PRIMARY' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`a`) +) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY KEY (a) */ +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1; +a +12 +13 +14 +DROP TABLE t1; +# Bug#30102 test +CREATE TABLE t1 (a INT) +ENGINE = MyISAM +PARTITION BY RANGE (a) +(PARTITION p0 VALUES LESS THAN (6), +PARTITION `p1....................` VALUES LESS THAN (9), +PARTITION p2 VALUES LESS THAN MAXVALUE); +# List of files in database `test`, all original t1-files here +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD +t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI +t1#P#p2.MYD +t1#P#p2.MYI +t1.frm +t1.par +INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +# Renaming to a file name where the first partition is 250 chars +# and the second partition is 350 chars +RENAME TABLE t1 TO `t2_new..............................................end`; +Got one of the listed errors +# List of files in database `test`, should not be any t2-files here +# List of files in database `test`, should be all t1-files here +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD +t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI +t1#P#p2.MYD +t1#P#p2.MYI +t1.frm +t1.par +SELECT * FROM t1; +a +1 +10 +2 +3 +4 +5 +6 +7 +8 +9 +# List of files in database `test`, should be all t1-files here +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD +t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI +t1#P#p2.MYD +t1#P#p2.MYI +t1.frm +t1.par +# Renaming to a file name where the first partition is 156 chars +# and the second partition is 256 chars +RENAME TABLE t1 TO `t2_............................_end`; +Got one of the listed errors +# List of files in database `test`, should not be any t2-files here +# List of files in database `test`, should be all t1-files here +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD +t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI +t1#P#p2.MYD +t1#P#p2.MYI +t1.frm +t1.par +SELECT * FROM t1; +a +1 +10 +2 +3 +4 +5 +6 +7 +8 +9 +DROP TABLE t1; +# Should not be any files left here +# End of bug#30102 test. diff --git a/mysql-test/r/partition_not_embedded.result b/mysql-test/r/partition_not_embedded.result deleted file mode 100644 index c942189a956..00000000000 --- a/mysql-test/r/partition_not_embedded.result +++ /dev/null @@ -1,81 +0,0 @@ -DROP TABLE IF EXISTS t1, t2; -# Bug#30102 test -CREATE TABLE t1 (a INT) -PARTITION BY RANGE (a) -(PARTITION p0 VALUES LESS THAN (6), -PARTITION `p1....................` VALUES LESS THAN (9), -PARTITION p2 VALUES LESS THAN MAXVALUE); -# List of files in database `test`, all original t1-files here -t1#P#p0.MYD -t1#P#p0.MYI -t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD -t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI -t1#P#p2.MYD -t1#P#p2.MYI -t1.frm -t1.par -INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); -# Renaming to a file name where the first partition is 250 chars -# and the second partition is 350 chars -RENAME TABLE t1 TO `t2_new..............................................end`; -Got one of the listed errors -# List of files in database `test`, should not be any t2-files here -# List of files in database `test`, should be all t1-files here -t1#P#p0.MYD -t1#P#p0.MYI -t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD -t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI -t1#P#p2.MYD -t1#P#p2.MYI -t1.frm -t1.par -SELECT * FROM t1; -a -1 -10 -2 -3 -4 -5 -6 -7 -8 -9 -# List of files in database `test`, should be all t1-files here -t1#P#p0.MYD -t1#P#p0.MYI -t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD -t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI -t1#P#p2.MYD -t1#P#p2.MYI -t1.frm -t1.par -# Renaming to a file name where the first partition is 156 chars -# and the second partition is 256 chars -RENAME TABLE t1 TO `t2_............................_end`; -Got one of the listed errors -# List of files in database `test`, should not be any t2-files here -# List of files in database `test`, should be all t1-files here -t1#P#p0.MYD -t1#P#p0.MYI -t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYD -t1#P#p1@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e@002e.MYI -t1#P#p2.MYD -t1#P#p2.MYI -t1.frm -t1.par -SELECT * FROM t1; -a -1 -10 -2 -3 -4 -5 -6 -7 -8 -9 -DROP TABLE t1; -# Should not be any files left here -# End of bug#30102 test. diff --git a/mysql-test/r/partition_symlink.result b/mysql-test/r/partition_symlink.result index 60184d11d9c..f26a1642a52 100644 --- a/mysql-test/r/partition_symlink.result +++ b/mysql-test/r/partition_symlink.result @@ -6,11 +6,12 @@ DROP DATABASE IF EXISTS mysqltest2; CREATE USER mysqltest_1@localhost; CREATE DATABASE mysqltest2; USE mysqltest2; -CREATE TABLE t1 (a INT); +CREATE TABLE t1 (a INT) ENGINE = MyISAM; INSERT INTO t1 VALUES (0); # user mysqltest_1: USE test; CREATE TABLE t1 (a INT) +ENGINE = MyISAM PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp' @@ -47,6 +48,7 @@ DROP DATABASE mysqltest2; CREATE DATABASE mysqltest2; USE mysqltest2; CREATE TABLE t1 (a INT) +ENGINE = MyISAM PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp' @@ -58,6 +60,7 @@ DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp' # user mysqltest_1: USE test; CREATE TABLE t1 (a INT) +ENGINE = MyISAM PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp' @@ -68,6 +71,7 @@ DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp' ); Got one of the listed errors CREATE TABLE t1 (a INT) +ENGINE = MyISAM PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp' @@ -82,6 +86,7 @@ DROP DATABASE mysqltest2; USE test; DROP USER mysqltest_1@localhost; create table t2 (i int ) +ENGINE = MyISAM partition by range (i) ( partition p01 values less than (1000) @@ -94,6 +99,7 @@ select @@sql_mode; @@sql_mode NO_DIR_IN_CREATE create table t1 (i int ) +ENGINE = MyISAM partition by range (i) ( partition p01 values less than (1000) @@ -113,10 +119,12 @@ t2 CREATE TABLE `t2` ( DROP TABLE t1, t2; set @@sql_mode=@org_mode; create table t1 (a int) +ENGINE = MyISAM partition by key (a) (partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data'); Got one of the listed errors create table t1 (a int) +ENGINE = MyISAM partition by key (a) (partition p0, partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data'); diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index 61b14b81fca..536935420a4 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -741,65 +741,9 @@ DROP TABLE t1; CREATE TABLE t1 (c TIMESTAMP) PARTITION BY HASH (c) PARTITIONS 4; +--echo # Moved to partition_myisam, since it was MyISAM specific --echo # Added test with existing TIMESTAMP partitioning (when it was allowed). -CREATE TABLE t1 (a TIMESTAMP) -PARTITION BY HASH (UNIX_TIMESTAMP(a)); -INSERT INTO t1 VALUES ('2000-01-02 03:04:05'); ---sorted_result -SELECT * FROM t1; -FLUSH TABLES; ---echo # replacing t1.frm with TO_DAYS(a) which was allowed earlier. ---remove_file $MYSQLD_DATADIR/test/t1.frm ---copy_file std_data/parts/t1TIMESTAMP.frm $MYSQLD_DATADIR/test/t1.frm ---echo # Disable warnings, since the result would differ when running with ---echo # --ps-protocol (only for the 'SELECT * FROM t1' statement). ---disable_warnings ---sorted_result -SELECT * FROM t1; ---enable_warnings -SHOW CREATE TABLE t1; -INSERT INTO t1 VALUES ('2001-02-03 04:05:06'); ---sorted_result -SELECT * FROM t1; -ALTER TABLE t1 ADD PARTITION PARTITIONS 2; ---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR -ALTER TABLE t1 -PARTITION BY RANGE (TO_DAYS(a)) -(PARTITION p0 VALUES LESS THAN (10000), - PARTITION p1 VALUES LESS THAN (MAXVALUE)); -SHOW CREATE TABLE t1; -CREATE TABLE t2 LIKE t1; -SHOW CREATE TABLE t2; -DROP TABLE t2; -CREATE TABLE t2 SELECT * FROM t1; -DROP TABLE t2; -ALTER TABLE t1 PARTITION BY HASH (UNIX_TIMESTAMP(a)); -SHOW CREATE TABLE t1; -ALTER TABLE t1 ADD PARTITION PARTITIONS 2; -SHOW CREATE TABLE t1; ---sorted_result -SELECT * FROM t1; -DROP TABLE t1; - ---echo # ---echo # Bug#49161: Out of memory; restart server and try again (needed 2 bytes) ---echo # -CREATE TABLE t1 (a INT) PARTITION BY HASH (a); -FLUSH TABLES; ---remove_file $MYSQLD_DATADIR/test/t1.par ---replace_result $MYSQLD_DATADIR ./ -CHECK TABLE t1; ---error ER_FAILED_READ_FROM_PAR_FILE -SELECT * FROM t1; ---echo # Note that it is currently impossible to drop a partitioned table ---echo # without the .par file ---error ER_BAD_TABLE_ERROR -DROP TABLE t1; ---remove_file $MYSQLD_DATADIR/test/t1.frm ---remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYI ---remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYD - --echo # --echo # Bug#49477: Assertion `0' failed in ha_partition.cc:5530 --echo # with temporary table and partitions @@ -820,6 +764,7 @@ SUBPARTITION BY HASH(TO_DAYS(purchased)) (PARTITION p0 VALUES LESS THAN MAXVALUE DATA DIRECTORY = '/tmp/not-existing' INDEX DIRECTORY = '/tmp/not-existing'); +--replace_result MyISAM <curr_engine> InnoDB <curr_engine> SHOW CREATE TABLE t1; DROP TABLE t1; CREATE TABLE t1 (id INT, purchased DATE) @@ -830,6 +775,7 @@ SUBPARTITION BY HASH(TO_DAYS(purchased)) SUBPARTITIONS 2 DATA DIRECTORY = '/tmp/not-existing' INDEX DIRECTORY = '/tmp/not-existing', SUBPARTITION sp1)); +--replace_result MyISAM <curr_engine> InnoDB <curr_engine> SHOW CREATE TABLE t1; DROP TABLE t1; CREATE TABLE t1 (id INT, purchased DATE) @@ -837,34 +783,11 @@ PARTITION BY RANGE(YEAR(purchased)) (PARTITION p0 VALUES LESS THAN MAXVALUE DATA DIRECTORY = '/tmp/not-existing' INDEX DIRECTORY = '/tmp/not-existing'); +--replace_result MyISAM <curr_engine> InnoDB <curr_engine> SHOW CREATE TABLE t1; DROP TABLE t1; SET @@sql_mode= @org_mode; ---echo # ---echo # Bug#50392: insert_id is not reset for partitioned tables ---echo # auto_increment on duplicate entry -CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY); -SET INSERT_ID= 13; -INSERT INTO t1 VALUES (NULL); -SET INSERT_ID= 12; ---error ER_DUP_ENTRY -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SHOW CREATE TABLE t1; -INSERT INTO t1 VALUES (NULL); -SELECT * FROM t1; -DROP TABLE t1; -CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) PARTITION BY KEY(a); -SET INSERT_ID= 13; -INSERT INTO t1 VALUES (NULL); -SET INSERT_ID= 12; ---error ER_DUP_ENTRY -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SHOW CREATE TABLE t1; -INSERT INTO t1 VALUES (NULL); -SELECT * FROM t1; -DROP TABLE t1; - # # Bug#38719: Partitioning returns a different error code for a # duplicate key error @@ -879,24 +802,6 @@ INSERT INTO t1 VALUES (1),(1); DROP TABLE t1; # -# Bug#31931: Mix of handlers error message -# ---error ER_MIX_HANDLER_ERROR -CREATE TABLE t1 (a INT) -PARTITION BY HASH (a) -( PARTITION p0 ENGINE=MyISAM, - PARTITION p1); ---error ER_MIX_HANDLER_ERROR -CREATE TABLE t1 (a INT) -PARTITION BY LIST (a) -SUBPARTITION BY HASH (a) -( PARTITION p0 VALUES IN (0) -( SUBPARTITION s0, SUBPARTITION s1 ENGINE=MyISAM, SUBPARTITION s2), - PARTITION p1 VALUES IN (1) -( SUBPARTITION s3 ENGINE=MyISAM, SUBPARTITION s4, SUBPARTITION s5 ENGINE=MyISAM)); - - -# # Bug 29368: # Incorrect error, 1467, for syntax error when creating partition --error ER_PARTITION_REQUIRES_VALUES_ERROR @@ -912,7 +817,7 @@ PARTITION BY RANGE (a) # # Partition by key stand-alone error # ---error 1064 +--error ER_PARSE_ERROR partition by list (a) partitions 3 (partition x1 values in (1,2,9,4) tablespace ts1, @@ -949,7 +854,7 @@ partitions 3 # # Partition by key, partition function not allowed # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -964,7 +869,7 @@ partitions 3 # # Partition by key, no partition name # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -995,7 +900,7 @@ select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Partition by hash, invalid field in function # ---error 1054 +--error ER_BAD_FIELD_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1025,7 +930,7 @@ partitions 3 # # Partition by key specified 3 partitions but only defined 2 => error # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1038,7 +943,7 @@ partitions 3 # # Partition by hash, random function # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1051,7 +956,7 @@ partitions 2 # # Partition by range, random function # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1064,7 +969,7 @@ partitions 2 # # Partition by list, random function # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1200,7 +1105,7 @@ select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Subpartition by hash, no partitions defined, wrong subpartition function # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1227,7 +1132,7 @@ select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Subpartition by hash, no partitions defined, wrong subpartition function # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1268,7 +1173,7 @@ subpartition by hash (3+4); # # Subpartition by hash, no partitions defined, wrong subpartition function # ---error 1054 +--error ER_BAD_FIELD_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1294,7 +1199,7 @@ select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Partition by range, invalid field in function # ---error 1054 +--error ER_BAD_FIELD_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1448,7 +1353,7 @@ partitions 2 # # Subpartition by hash, wrong number of subpartitions # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1468,7 +1373,7 @@ subpartitions 3 # # Subpartition by hash, wrong number of subpartitions # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1488,7 +1393,7 @@ subpartition by hash (a+b) # # Subpartition by list => error # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1507,7 +1412,7 @@ subpartition by list (a+b) # # Subpartition by list => error # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1551,7 +1456,7 @@ partitions 2 # # Partition by list, invalid field in function # ---error 1054 +--error ER_BAD_FIELD_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1635,7 +1540,7 @@ partitions 2 # # Partition by list, missing parenthesis # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1649,7 +1554,7 @@ partitions 2 # # Bug #13439: Crash when LESS THAN (non-literal) # ---error 1054 +--error ER_BAD_FIELD_ERROR CREATE TABLE t1 (a int) PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (x1)); @@ -1676,13 +1581,13 @@ partition by range (ascii(v)) (partition p0 values less than (10)); #drop table t1; --- error 1064 +-- error ER_PARSE_ERROR create table t1 (a int) partition by hash (rand(a)); --- error 1064 +-- error ER_PARSE_ERROR create table t1 (a int) partition by hash(CURTIME() + a); --- error 1064 +-- error ER_PARSE_ERROR create table t1 (a int) partition by hash (NOW()+a); -- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED diff --git a/mysql-test/t/partition_myisam.test b/mysql-test/t/partition_myisam.test new file mode 100644 index 00000000000..37d4a071fb9 --- /dev/null +++ b/mysql-test/t/partition_myisam.test @@ -0,0 +1,173 @@ +-- source include/have_partition.inc + +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +# These tests is only useful when running on MyISAM, +# due to DATA/INDEX directory, non transactional behavior, tests with MyISAM +# files etc. + +let $MYSQLD_DATADIR= `SELECT @@datadir`; + + +--echo # +--echo # Bug#50036: Inconsistent errors when using TIMESTAMP +--echo # columns/expressions + +--echo # Added test with existing TIMESTAMP partitioning (when it was allowed). +CREATE TABLE t1 (a TIMESTAMP) +ENGINE = MyISAM +PARTITION BY HASH (UNIX_TIMESTAMP(a)); +INSERT INTO t1 VALUES ('2000-01-02 03:04:05'); +--sorted_result +SELECT * FROM t1; +FLUSH TABLES; +--echo # replacing t1.frm with TO_DAYS(a) which was allowed earlier. +--remove_file $MYSQLD_DATADIR/test/t1.frm +--copy_file std_data/parts/t1TIMESTAMP.frm $MYSQLD_DATADIR/test/t1.frm +--echo # Disable warnings, since the result would differ when running with +--echo # --ps-protocol (only for the 'SELECT * FROM t1' statement). +--disable_warnings +--sorted_result +SELECT * FROM t1; +--enable_warnings +--replace_result MyISAM <curr_engine> InnoDB <curr_engine> +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('2001-02-03 04:05:06'); +--sorted_result +SELECT * FROM t1; +ALTER TABLE t1 ADD PARTITION PARTITIONS 2; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE t1 +PARTITION BY RANGE (TO_DAYS(a)) +(PARTITION p0 VALUES LESS THAN (10000), + PARTITION p1 VALUES LESS THAN (MAXVALUE)); +SHOW CREATE TABLE t1; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; +CREATE TABLE t2 SELECT * FROM t1; +DROP TABLE t2; +ALTER TABLE t1 PARTITION BY HASH (UNIX_TIMESTAMP(a)); +SHOW CREATE TABLE t1; +ALTER TABLE t1 ADD PARTITION PARTITIONS 2; +SHOW CREATE TABLE t1; +--sorted_result +SELECT * FROM t1; +DROP TABLE t1; + + +--echo # +--echo # Bug#31931: Mix of handlers error message +--echo # +--error ER_MIX_HANDLER_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (a) +( PARTITION p0 ENGINE=MyISAM, + PARTITION p1); +--error ER_MIX_HANDLER_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY LIST (a) +SUBPARTITION BY HASH (a) +( PARTITION p0 VALUES IN (0) +( SUBPARTITION s0, SUBPARTITION s1 ENGINE=MyISAM, SUBPARTITION s2), + PARTITION p1 VALUES IN (1) +( SUBPARTITION s3 ENGINE=MyISAM, SUBPARTITION s4, SUBPARTITION s5 ENGINE=MyISAM)); + +--echo # +--echo # Bug#49161: Out of memory; restart server and try again (needed 2 bytes) +--echo # +CREATE TABLE t1 (a INT) +ENGINE = MyISAM +PARTITION BY HASH (a); +FLUSH TABLES; +--remove_file $MYSQLD_DATADIR/test/t1.par +--replace_result $MYSQLD_DATADIR ./ +CHECK TABLE t1; +--error ER_FAILED_READ_FROM_PAR_FILE +SELECT * FROM t1; +--echo # Note that it is currently impossible to drop a partitioned table +--echo # without the .par file +--error ER_BAD_TABLE_ERROR +DROP TABLE t1; +--remove_file $MYSQLD_DATADIR/test/t1.frm +--remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYI +--remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYD + +--echo # +--echo # Bug#50392: insert_id is not reset for partitioned tables +--echo # auto_increment on duplicate entry +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) +ENGINE = MyISAM; +SET INSERT_ID= 13; +INSERT INTO t1 VALUES (NULL); +SET INSERT_ID= 12; +--echo # For transactional engines, 12 will not be inserted, since the failing +--echo # statement is rolled back. +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (NULL), (NULL), (NULL); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES (NULL); +--echo # NOTE: 12 exists only in non transactional engines! +SELECT * FROM t1; +DROP TABLE t1; +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) +ENGINE = MyISAM +PARTITION BY KEY(a); +SET INSERT_ID= 13; +INSERT INTO t1 VALUES (NULL); +SET INSERT_ID= 12; +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (NULL), (NULL), (NULL); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1; +DROP TABLE t1; +# +# Bug#30102: rename table does corrupt tables with partition files on failure +# +--echo # Bug#30102 test +CREATE TABLE t1 (a INT) +ENGINE = MyISAM +PARTITION BY RANGE (a) +(PARTITION p0 VALUES LESS THAN (6), + PARTITION `p1....................` VALUES LESS THAN (9), + PARTITION p2 VALUES LESS THAN MAXVALUE); +# partition p1 is 't1#P#p1' + @002e * 20 = 107 characters + file ending +# total path lenght of './test/t1#P#p1@002e@002e<...>@002e.MY[ID]' is 118 chars +--echo # List of files in database `test`, all original t1-files here +--list_files $MYSQLD_DATADIR/test t1* +INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +--echo # Renaming to a file name where the first partition is 250 chars +--echo # and the second partition is 350 chars +# 7,7 avoids the error message, which is not deterministic. +--error 7,7 +RENAME TABLE t1 TO `t2_new..............................................end`; +# 1234567890123456789012345678901234567890123456 +--echo # List of files in database `test`, should not be any t2-files here +--list_files $MYSQLD_DATADIR/test t2* +--echo # List of files in database `test`, should be all t1-files here +--list_files $MYSQLD_DATADIR/test t1* +--sorted_result +SELECT * FROM t1; +--echo # List of files in database `test`, should be all t1-files here +--list_files $MYSQLD_DATADIR/test t1* +--echo # Renaming to a file name where the first partition is 156 chars +--echo # and the second partition is 256 chars +# 7,7 avoids the error message, which is not deterministic. +--error 7,7 +RENAME TABLE t1 TO `t2_............................_end`; +# 1234567890123456789012345678 +# 7 + 4 + 5 + 28 * 5 = 16 + 140 = 156 +--echo # List of files in database `test`, should not be any t2-files here +--list_files $MYSQLD_DATADIR/test t2* +--echo # List of files in database `test`, should be all t1-files here +--list_files $MYSQLD_DATADIR/test t1* +--sorted_result +SELECT * FROM t1; +DROP TABLE t1; +--echo # Should not be any files left here +--list_files $MYSQLD_DATADIR/test t1* +--list_files $MYSQLD_DATADIR/test t2* +--echo # End of bug#30102 test. diff --git a/mysql-test/t/partition_not_embedded.test b/mysql-test/t/partition_not_embedded.test deleted file mode 100644 index 5c512085a9e..00000000000 --- a/mysql-test/t/partition_not_embedded.test +++ /dev/null @@ -1,53 +0,0 @@ --- source include/have_partition.inc --- source include/not_embedded.inc ---disable_warnings -DROP TABLE IF EXISTS t1, t2; ---enable_warnings -let $MYSQLD_DATADIR= `SELECT @@datadir`; - -# -# Bug#30102: rename table does corrupt tables with partition files on failure -# ---echo # Bug#30102 test -CREATE TABLE t1 (a INT) -PARTITION BY RANGE (a) -(PARTITION p0 VALUES LESS THAN (6), - PARTITION `p1....................` VALUES LESS THAN (9), - PARTITION p2 VALUES LESS THAN MAXVALUE); -# partition p1 is 't1#P#p1' + @002e * 20 = 107 characters + file ending -# total path lenght of './test/t1#P#p1@002e@002e<...>@002e.MY[ID]' is 118 chars ---echo # List of files in database `test`, all original t1-files here ---list_files $MYSQLD_DATADIR/test t1* -INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); ---echo # Renaming to a file name where the first partition is 250 chars ---echo # and the second partition is 350 chars -# 7,7 avoids the error message, which is not deterministic. ---error 7,7 -RENAME TABLE t1 TO `t2_new..............................................end`; -# 1234567890123456789012345678901234567890123456 ---echo # List of files in database `test`, should not be any t2-files here ---list_files $MYSQLD_DATADIR/test t2* ---echo # List of files in database `test`, should be all t1-files here ---list_files $MYSQLD_DATADIR/test t1* ---sorted_result -SELECT * FROM t1; ---echo # List of files in database `test`, should be all t1-files here ---list_files $MYSQLD_DATADIR/test t1* ---echo # Renaming to a file name where the first partition is 156 chars ---echo # and the second partition is 256 chars -# 7,7 avoids the error message, which is not deterministic. ---error 7,7 -RENAME TABLE t1 TO `t2_............................_end`; -# 1234567890123456789012345678 -# 7 + 4 + 5 + 28 * 5 = 16 + 140 = 156 ---echo # List of files in database `test`, should not be any t2-files here ---list_files $MYSQLD_DATADIR/test t2* ---echo # List of files in database `test`, should be all t1-files here ---list_files $MYSQLD_DATADIR/test t1* ---sorted_result -SELECT * FROM t1; -DROP TABLE t1; ---echo # Should not be any files left here ---list_files $MYSQLD_DATADIR/test t1* ---list_files $MYSQLD_DATADIR/test t2* ---echo # End of bug#30102 test. diff --git a/mysql-test/t/partition_symlink.test b/mysql-test/t/partition_symlink.test index 4147d2c6e89..5fdde8e0abc 100644 --- a/mysql-test/t/partition_symlink.test +++ b/mysql-test/t/partition_symlink.test @@ -1,5 +1,6 @@ # Test that must have symlink. eg. using DATA/INDEX DIR # (DATA/INDEX DIR requires symlinks) +# This test is only useful for MyISAM, since no other engine supports DATA DIR -- source include/have_partition.inc -- source include/have_symlink.inc # remove the not_windows line after fixing bug#33687 @@ -33,13 +34,14 @@ DROP DATABASE IF EXISTS mysqltest2; CREATE USER mysqltest_1@localhost; CREATE DATABASE mysqltest2; USE mysqltest2; - CREATE TABLE t1 (a INT); + CREATE TABLE t1 (a INT) ENGINE = MyISAM; INSERT INTO t1 VALUES (0); connect(con1,localhost,mysqltest_1,,); -- echo # user mysqltest_1: USE test; -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval CREATE TABLE t1 (a INT) + ENGINE = MyISAM PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp' @@ -82,6 +84,7 @@ connection default; USE mysqltest2; -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval CREATE TABLE t1 (a INT) + ENGINE = MyISAM PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp' @@ -96,6 +99,7 @@ connection con1; -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -- error 1,1 eval CREATE TABLE t1 (a INT) + ENGINE = MyISAM PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp' @@ -107,6 +111,7 @@ connection con1; -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -- error 1,1 eval CREATE TABLE t1 (a INT) + ENGINE = MyISAM PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp' @@ -128,6 +133,7 @@ connection default; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval create table t2 (i int ) +ENGINE = MyISAM partition by range (i) ( partition p01 values less than (1000) @@ -139,6 +145,7 @@ set @org_mode=@@sql_mode; set @@sql_mode='NO_DIR_IN_CREATE'; select @@sql_mode; create table t1 (i int ) +ENGINE = MyISAM partition by range (i) ( partition p01 values less than (1000) @@ -157,6 +164,7 @@ set @@sql_mode=@org_mode; # Added ER_WRONG_TABLE_NAME and reported bug#39045 -- error ER_WRONG_ARGUMENTS, ER_WRONG_TABLE_NAME create table t1 (a int) +ENGINE = MyISAM partition by key (a) (partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data'); @@ -167,6 +175,7 @@ partition by key (a) # Added ER_WRONG_TABLE_NAME and reported bug#39045 --error ER_WRONG_ARGUMENTS, ER_WRONG_TABLE_NAME create table t1 (a int) +ENGINE = MyISAM partition by key (a) (partition p0, partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data'); |