diff options
Diffstat (limited to 'mysql-test/suite/parts')
-rw-r--r-- | mysql-test/suite/parts/inc/partition_fail.inc | 20 | ||||
-rw-r--r-- | mysql-test/suite/parts/r/partition_debug_innodb.result | 1886 | ||||
-rw-r--r-- | mysql-test/suite/parts/r/partition_debug_myisam.result | 2016 | ||||
-rw-r--r-- | mysql-test/suite/parts/r/partition_special_innodb.result | 5 | ||||
-rw-r--r-- | mysql-test/suite/parts/t/partition_special_innodb.test | 2 |
5 files changed, 3919 insertions, 10 deletions
diff --git a/mysql-test/suite/parts/inc/partition_fail.inc b/mysql-test/suite/parts/inc/partition_fail.inc index 2c154a90499..f433712e284 100644 --- a/mysql-test/suite/parts/inc/partition_fail.inc +++ b/mysql-test/suite/parts/inc/partition_fail.inc @@ -18,3 +18,23 @@ SHOW CREATE TABLE t1; --sorted_result SELECT * FROM t1; DROP TABLE t1; + +--echo # Same test under LOCK TABLE +--eval $create_statement +--eval $insert_statement +--echo # State before failure +--list_files $DATADIR/test +SHOW CREATE TABLE t1; +--sorted_result +SELECT * FROM t1; +LOCK TABLE t1 WRITE; +--disable_abort_on_error +--eval $fail_statement +--enable_abort_on_error +--echo # State after failure +--list_files $DATADIR/test +SHOW CREATE TABLE t1; +--sorted_result +SELECT * FROM t1; +UNLOCK TABLES; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/r/partition_debug_innodb.result b/mysql-test/suite/parts/r/partition_debug_innodb.result index eb2218e204e..49d863bca8e 100644 --- a/mysql-test/suite/parts/r/partition_debug_innodb.result +++ b/mysql-test/suite/parts/r/partition_debug_innodb.result @@ -747,6 +747,67 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_1"; SET SESSION debug="+d,fail_add_partition_2"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -807,6 +868,67 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_2"; SET SESSION debug="+d,fail_add_partition_3"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -867,6 +989,67 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_3"; SET SESSION debug="+d,fail_add_partition_4"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -927,6 +1110,67 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_4"; SET SESSION debug="+d,fail_add_partition_5"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -987,6 +1231,67 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_5"; SET SESSION debug="+d,fail_add_partition_6"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -1047,6 +1352,67 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_6"; SET SESSION debug="+d,fail_add_partition_7"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -1107,6 +1473,67 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_7"; SET SESSION debug="+d,fail_add_partition_8"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -1169,6 +1596,69 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1#P#p20.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_8"; SET SESSION debug="+d,fail_add_partition_9"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -1231,6 +1721,69 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1#P#p20.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_9"; SET SESSION debug="+d,fail_add_partition_10"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -1293,6 +1846,69 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1#P#p20.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_10"; # Test DROP PARTITION SET SESSION debug="+d,crash_drop_partition_1"; @@ -1902,6 +2518,66 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 DROP PARTITION p10; +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_drop_partition_1"; SET SESSION debug="+d,fail_drop_partition_2"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -1961,6 +2637,66 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 DROP PARTITION p10; +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_drop_partition_2"; SET SESSION debug="+d,fail_drop_partition_3"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -2020,6 +2756,66 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 DROP PARTITION p10; +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_drop_partition_3"; SET SESSION debug="+d,fail_drop_partition_4"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -2073,6 +2869,60 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 DROP PARTITION p10; +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_drop_partition_4"; SET SESSION debug="+d,fail_drop_partition_5"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -2126,6 +2976,60 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 DROP PARTITION p10; +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_drop_partition_5"; SET SESSION debug="+d,fail_drop_partition_6"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -2179,6 +3083,60 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 DROP PARTITION p10; +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_drop_partition_6"; SET SESSION debug="+d,fail_drop_partition_7"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -2232,6 +3190,60 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 DROP PARTITION p10; +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_drop_partition_7"; SET SESSION debug="+d,fail_drop_partition_8"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -2285,6 +3297,60 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 DROP PARTITION p10; +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_drop_partition_8"; SET SESSION debug="+d,fail_drop_partition_9"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -2338,6 +3404,60 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 DROP PARTITION p10; +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_drop_partition_9"; # Test change partition (REORGANIZE/REBUILD/COALESCE # or ADD HASH PARTITION). @@ -2730,6 +3850,7 @@ t1.par # State after crash recovery t1#P#p0.ibd t1#P#p10.ibd +t1#P#p20.ibd t1.frm t1.par SHOW CREATE TABLE t1; @@ -2740,7 +3861,8 @@ t1 CREATE TABLE `t1` ( ) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ + PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ SELECT * FROM t1; a b 1 Original from partition p0 @@ -2861,8 +3983,6 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par t1#P#p0.ibd t1#P#p10#TMP#.ibd t1#P#p10.ibd @@ -3237,6 +4357,68 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_1"; SET SESSION debug="+d,fail_change_partition_2"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -3298,6 +4480,68 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_2"; SET SESSION debug="+d,fail_change_partition_3"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -3359,6 +4603,68 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_3"; SET SESSION debug="+d,fail_change_partition_4"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -3420,6 +4726,68 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_4"; SET SESSION debug="+d,fail_change_partition_5"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -3481,6 +4849,68 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_5"; SET SESSION debug="+d,fail_change_partition_6"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -3520,6 +4950,40 @@ ERROR HY000: Unknown error # State after failure t1#P#p0.ibd t1#P#p10.ibd +t1#P#p20.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd t1.frm t1.par SHOW CREATE TABLE t1; @@ -3541,6 +5005,38 @@ a b 2 Original from partition p0 3 Original from partition p0 4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1#P#p20.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_6"; SET SESSION debug="+d,fail_change_partition_7"; @@ -3605,6 +5101,70 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1#P#p20.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_7"; SET SESSION debug="+d,fail_change_partition_8"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -3668,6 +5228,70 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1#P#p20.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_8"; SET SESSION debug="+d,fail_change_partition_9"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -3731,6 +5355,70 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1#P#p20.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_9"; SET SESSION debug="+d,fail_change_partition_10"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -3794,6 +5482,70 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1#P#p20.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_10"; SET SESSION debug="+d,fail_change_partition_11"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -3857,6 +5609,70 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1#P#p20.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_11"; SET SESSION debug="+d,fail_change_partition_12"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -3920,4 +5736,68 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'InnoDB' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.ibd +t1#P#p10.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.ibd +t1#P#p10.ibd +t1#P#p20.ibd +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB, + PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_12"; diff --git a/mysql-test/suite/parts/r/partition_debug_myisam.result b/mysql-test/suite/parts/r/partition_debug_myisam.result index d3f40aedee5..ca3dd708972 100644 --- a/mysql-test/suite/parts/r/partition_debug_myisam.result +++ b/mysql-test/suite/parts/r/partition_debug_myisam.result @@ -817,6 +817,71 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_1"; SET SESSION debug="+d,fail_add_partition_2"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -881,6 +946,71 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_2"; SET SESSION debug="+d,fail_add_partition_3"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -945,6 +1075,71 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_3"; SET SESSION debug="+d,fail_add_partition_4"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -1009,6 +1204,71 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_4"; SET SESSION debug="+d,fail_add_partition_5"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -1073,6 +1333,71 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_5"; SET SESSION debug="+d,fail_add_partition_6"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -1137,6 +1462,71 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_6"; SET SESSION debug="+d,fail_add_partition_7"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -1201,6 +1591,71 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_7"; SET SESSION debug="+d,fail_add_partition_8"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -1268,6 +1723,74 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1#P#p20.MYD +t1#P#p20.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_8"; SET SESSION debug="+d,fail_add_partition_9"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -1335,6 +1858,74 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1#P#p20.MYD +t1#P#p20.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_9"; SET SESSION debug="+d,fail_add_partition_10"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -1402,6 +1993,74 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 ADD PARTITION +(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1#P#p20.MYD +t1#P#p20.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_add_partition_10"; # Test DROP PARTITION SET SESSION debug="+d,crash_drop_partition_1"; @@ -2061,6 +2720,70 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 DROP PARTITION p10; +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_drop_partition_1"; SET SESSION debug="+d,fail_drop_partition_2"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -2124,6 +2847,70 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 DROP PARTITION p10; +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_drop_partition_2"; SET SESSION debug="+d,fail_drop_partition_3"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -2187,6 +2974,70 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 DROP PARTITION p10; +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_drop_partition_3"; SET SESSION debug="+d,fail_drop_partition_4"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -2243,6 +3094,63 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 DROP PARTITION p10; +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_drop_partition_4"; SET SESSION debug="+d,fail_drop_partition_5"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -2299,6 +3207,63 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 DROP PARTITION p10; +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_drop_partition_5"; SET SESSION debug="+d,fail_drop_partition_6"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -2355,6 +3320,63 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 DROP PARTITION p10; +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_drop_partition_6"; SET SESSION debug="+d,fail_drop_partition_7"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -2411,6 +3433,63 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 DROP PARTITION p10; +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_drop_partition_7"; SET SESSION debug="+d,fail_drop_partition_8"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -2467,6 +3546,63 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 DROP PARTITION p10; +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_drop_partition_8"; SET SESSION debug="+d,fail_drop_partition_9"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -2523,6 +3659,63 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 DROP PARTITION p10; +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_drop_partition_9"; # Test change partition (REORGANIZE/REBUILD/COALESCE # or ADD HASH PARTITION). @@ -2957,6 +4150,8 @@ t1#P#p0.MYD t1#P#p0.MYI t1#P#p10.MYD t1#P#p10.MYI +t1#P#p20.MYD +t1#P#p20.MYI t1.frm t1.par SHOW CREATE TABLE t1; @@ -2967,7 +4162,8 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (a) (PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, - PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ + PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ SELECT * FROM t1; a b 1 Original from partition p0 @@ -3099,8 +4295,6 @@ ALTER TABLE t1 REORGANIZE PARTITION p10 INTO PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); ERROR HY000: Lost connection to MySQL server during query # State after crash (before recovery) -#sql-t1.frm -#sql-t1.par t1#P#p0.MYD t1#P#p0.MYI t1#P#p10#TMP#.MYD @@ -3520,6 +4714,72 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_1"; SET SESSION debug="+d,fail_change_partition_2"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -3585,6 +4845,72 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_2"; SET SESSION debug="+d,fail_change_partition_3"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -3650,6 +4976,72 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_3"; SET SESSION debug="+d,fail_change_partition_4"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -3715,6 +5107,72 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_4"; SET SESSION debug="+d,fail_change_partition_5"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -3780,6 +5238,72 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_5"; SET SESSION debug="+d,fail_change_partition_6"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -3823,6 +5347,43 @@ t1#P#p0.MYD t1#P#p0.MYI t1#P#p10.MYD t1#P#p10.MYI +t1#P#p20.MYD +t1#P#p20.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI t1.frm t1.par SHOW CREATE TABLE t1; @@ -3844,6 +5405,41 @@ a b 2 Original from partition p0 3 Original from partition p0 4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1#P#p20.MYD +t1#P#p20.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_6"; SET SESSION debug="+d,fail_change_partition_7"; @@ -3913,6 +5509,75 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1#P#p20.MYD +t1#P#p20.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_7"; SET SESSION debug="+d,fail_change_partition_8"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -3981,6 +5646,75 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1#P#p20.MYD +t1#P#p20.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_8"; SET SESSION debug="+d,fail_change_partition_9"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -4049,6 +5783,75 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1#P#p20.MYD +t1#P#p20.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_9"; SET SESSION debug="+d,fail_change_partition_10"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -4117,6 +5920,75 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1#P#p20.MYD +t1#P#p20.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_10"; SET SESSION debug="+d,fail_change_partition_11"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -4185,6 +6057,75 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1#P#p20.MYD +t1#P#p20.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_11"; SET SESSION debug="+d,fail_change_partition_12"; CREATE TABLE t1 (a INT, b VARCHAR(64)) @@ -4253,4 +6194,73 @@ a b 3 Original from partition p0 4 Original from partition p0 DROP TABLE t1; +# Same test under LOCK TABLE +CREATE TABLE t1 (a INT, b VARCHAR(64)) +ENGINE = 'MyISAM' +PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9), +PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19)); +INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"); +# State before failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +LOCK TABLE t1 WRITE; +ALTER TABLE t1 REORGANIZE PARTITION p10 INTO +(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19), +PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29)); +ERROR HY000: Unknown error +# State after failure +t1#P#p0.MYD +t1#P#p0.MYI +t1#P#p10.MYD +t1#P#p10.MYI +t1#P#p20.MYD +t1#P#p20.MYI +t1.frm +t1.par +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` varchar(64) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY LIST (a) +(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM, + PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM, + PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */ +SELECT * FROM t1; +a b +1 Original from partition p0 +11 Original from partition p1 +12 Original from partition p1 +13 Original from partition p1 +14 Original from partition p1 +2 Original from partition p0 +3 Original from partition p0 +4 Original from partition p0 +UNLOCK TABLES; +DROP TABLE t1; SET SESSION debug="-d,fail_change_partition_12"; diff --git a/mysql-test/suite/parts/r/partition_special_innodb.result b/mysql-test/suite/parts/r/partition_special_innodb.result index 0738f45b012..c1213e86afc 100644 --- a/mysql-test/suite/parts/r/partition_special_innodb.result +++ b/mysql-test/suite/parts/r/partition_special_innodb.result @@ -238,11 +238,10 @@ LOCK TABLE t1 READ; # Third attempt: says that the table does not exist ALTER TABLE t1 ADD PARTITION PARTITIONS 2; ERROR HY000: Lock wait timeout exceeded; try restarting transaction -# Check table returns the same +# Check table returns the same (not after fixing bug#56172!) CHECK TABLE t1; Table Op Msg_type Msg_text -test.t1 check Error Lock wait timeout exceeded; try restarting transaction -test.t1 check status Operation failed +test.t1 check status OK UNLOCK TABLES; DROP TABLE t1; CREATE TABLE t2 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT ) diff --git a/mysql-test/suite/parts/t/partition_special_innodb.test b/mysql-test/suite/parts/t/partition_special_innodb.test index 9c26ab6fdb4..1c36299f4bd 100644 --- a/mysql-test/suite/parts/t/partition_special_innodb.test +++ b/mysql-test/suite/parts/t/partition_special_innodb.test @@ -111,7 +111,7 @@ LOCK TABLE t1 READ; --echo # Third attempt: says that the table does not exist --error ER_LOCK_WAIT_TIMEOUT ALTER TABLE t1 ADD PARTITION PARTITIONS 2; ---echo # Check table returns the same +--echo # Check table returns the same (not after fixing bug#56172!) CHECK TABLE t1; --connection con1 |