config root man

Current Path : /usr/opt/mysql57/mysql-test/suite/parts/r/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //usr/opt/mysql57/mysql-test/suite/parts/r/partition_debug_innodb.result

DROP TABLE IF EXISTS t1;
call mtr.add_suppression("InnoDB: Warning: allocated tablespace .*, old maximum was");
call mtr.add_suppression("InnoDB: Error: table .* does not exist in the InnoDB internal");
call mtr.add_suppression("InnoDB: Warning: MySQL is trying to drop table ");
# Test crash and failure recovery in fast_alter_partition_table.
#
# Bug#53676: Unexpected errors and possible table corruption on
# ADD PARTITION and LOCK TABLE
# Bug#53770: Server crash at handler.cc:2076 on LOAD DATA
# after timed out COALESCE PARTITION
# Extended crash recovery testing of fast_alter_partition_table.
call mtr.add_suppression("Attempting backtrace. You can use the following information to find out");
#
# Test without crash/failure injection
#
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 statement
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
ALTER TABLE t1 ADD PARTITION
(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
# State after statement
t1#P#p0.ibd
t1#P#p10.ibd
t1#P#p20.ibd
t1.frm
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
DROP TABLE t1;
# Crash testing ADD PARTITION
SET SESSION debug="+d,crash_add_partition_1";
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 crash
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
ALTER TABLE t1 ADD PARTITION
(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)
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
# State after crash recovery
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
DROP TABLE t1;
SET SESSION debug="-d,crash_add_partition_1";
SET SESSION debug="+d,crash_add_partition_2";
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 crash
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
ALTER TABLE t1 ADD PARTITION
(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
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
# State after crash recovery
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
DROP TABLE t1;
SET SESSION debug="-d,crash_add_partition_2";
SET SESSION debug="+d,crash_add_partition_3";
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 crash
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
ALTER TABLE t1 ADD PARTITION
(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
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
# State after crash recovery
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
DROP TABLE t1;
SET SESSION debug="-d,crash_add_partition_3";
SET SESSION debug="+d,crash_add_partition_4";
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 crash
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
ALTER TABLE t1 ADD PARTITION
(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
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
# State after crash recovery
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
DROP TABLE t1;
SET SESSION debug="-d,crash_add_partition_4";
SET SESSION debug="+d,crash_add_partition_5";
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 crash
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
ALTER TABLE t1 ADD PARTITION
(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
t1#P#p0.ibd
t1#P#p10.ibd
t1#P#p20.ibd
t1.frm
# State after crash recovery
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
DROP TABLE t1;
SET SESSION debug="-d,crash_add_partition_5";
SET SESSION debug="+d,crash_add_partition_6";
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 crash
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
ALTER TABLE t1 ADD PARTITION
(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
t1#P#p0.ibd
t1#P#p10.ibd
t1#P#p20.ibd
t1.frm
# State after crash recovery
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
DROP TABLE t1;
SET SESSION debug="-d,crash_add_partition_6";
SET SESSION debug="+d,crash_add_partition_7";
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 crash
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
ALTER TABLE t1 ADD PARTITION
(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
t1#P#p0.ibd
t1#P#p10.ibd
t1#P#p20.ibd
t1.frm
# State after crash recovery
t1#P#p0.ibd
t1#P#p10.ibd
t1#P#p20.ibd
t1.frm
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
DROP TABLE t1;
SET SESSION debug="-d,crash_add_partition_7";
# Error recovery testing ADD PARTITION
SET SESSION debug="+d,fail_add_partition_1";
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
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
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
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
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
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
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))
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
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
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
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
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
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
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))
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
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
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
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
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
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
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))
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
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
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
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
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
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
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))
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
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
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
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
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
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
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))
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
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
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
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
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
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
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))
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
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
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
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
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
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
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_7";
# Test DROP PARTITION
SET SESSION debug="+d,crash_drop_partition_1";
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 crash
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
# State after crash recovery
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
DROP TABLE t1;
SET SESSION debug="-d,crash_drop_partition_1";
SET SESSION debug="+d,crash_drop_partition_2";
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 crash
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
# State after crash recovery
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
DROP TABLE t1;
SET SESSION debug="-d,crash_drop_partition_2";
SET SESSION debug="+d,crash_drop_partition_3";
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 crash
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
# State after crash recovery
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
DROP TABLE t1;
SET SESSION debug="-d,crash_drop_partition_3";
SET SESSION debug="+d,crash_drop_partition_4";
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 crash
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
# State after crash recovery
t1#P#p0.ibd
t1.frm
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
DROP TABLE t1;
SET SESSION debug="-d,crash_drop_partition_4";
SET SESSION debug="+d,crash_drop_partition_5";
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 crash
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
# State after crash recovery
t1#P#p0.ibd
t1.frm
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
DROP TABLE t1;
SET SESSION debug="-d,crash_drop_partition_5";
# Error recovery DROP PARTITION
SET SESSION debug="+d,fail_drop_partition_1";
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
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
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
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
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
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))
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
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
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
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
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
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))
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
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
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
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
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
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))
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
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
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
t1#P#p0.ibd
t1.frm
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
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
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
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))
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
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
ALTER TABLE t1 DROP PARTITION p10;
ERROR HY000: Unknown error
# State after failure
t1#P#p0.ibd
t1.frm
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
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
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
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";
#
# Test without crash/failure injection
#
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 statement
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
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));
# State after statement
t1#P#p0.ibd
t1#P#p10.ibd
t1#P#p20.ibd
t1.frm
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;
# Test change partition (REORGANIZE/REBUILD/COALESCE
# or ADD HASH PARTITION).
SET SESSION debug="+d,crash_change_partition_1";
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 crash
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
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: Lost connection to MySQL server during query
# State after crash (before recovery)
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
# State after crash recovery
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
DROP TABLE t1;
SET SESSION debug="-d,crash_change_partition_1";
SET SESSION debug="+d,crash_change_partition_2";
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 crash
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
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: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
# State after crash recovery
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
DROP TABLE t1;
SET SESSION debug="-d,crash_change_partition_2";
SET SESSION debug="+d,crash_change_partition_3";
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 crash
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
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: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
# State after crash recovery
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
DROP TABLE t1;
SET SESSION debug="-d,crash_change_partition_3";
SET SESSION debug="+d,crash_change_partition_4";
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 crash
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
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: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
t1#P#p0.ibd
t1#P#p10#TMP#.ibd
t1#P#p10.ibd
t1#P#p20#TMP#.ibd
t1.frm
# State after crash recovery
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
DROP TABLE t1;
SET SESSION debug="-d,crash_change_partition_4";
SET SESSION debug="+d,crash_change_partition_5";
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 crash
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
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: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
t1#P#p0.ibd
t1#P#p10#TMP#.ibd
t1#P#p10.ibd
t1#P#p20#TMP#.ibd
t1.frm
# State after crash recovery
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
DROP TABLE t1;
SET SESSION debug="-d,crash_change_partition_5";
SET SESSION debug="+d,crash_change_partition_6";
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 crash
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
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: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
t1#P#p0.ibd
t1#P#p10#TMP#.ibd
t1#P#p10.ibd
t1#P#p20#TMP#.ibd
t1.frm
# State after crash recovery
t1#P#p0.ibd
t1#P#p10.ibd
t1#P#p20.ibd
t1.frm
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;
SET SESSION debug="-d,crash_change_partition_6";
SET SESSION debug="+d,crash_change_partition_7";
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 crash
t1#P#p0.ibd
t1#P#p10.ibd
t1.frm
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
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: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
t1#P#p0.ibd
t1#P#p10#TMP#.ibd
t1#P#p10.ibd
t1#P#p20#TMP#.ibd
t1.frm
# State after crash recovery
t1#P#p0.ibd
t1#P#p10.ibd
t1#P#p20.ibd
t1.frm
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;
SET SESSION debug="-d,crash_change_partition_7";
# Error recovery change partition (REORGANIZE/REBUILD/COALESCE
# or ADD HASH PARTITION).
SET SESSION debug="+d,fail_change_partition_1";
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
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
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
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
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
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
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))
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
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
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
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
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
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
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))
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
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
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
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
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
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
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))
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
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
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
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
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
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
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))
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
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
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
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
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
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
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))
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
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
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
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
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
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";
#
# WL#4445: EXCHANGE PARTITION WITH TABLE
# Verify ddl_log and InnoDB in case of crashing.
call mtr.add_suppression("InnoDB: Warning: allocated tablespace .*, old maximum was ");
call mtr.add_suppression("Attempting backtrace. You can use the following information to find out");
call mtr.add_suppression("table .* does not exist in the InnoDB internal");
SET SESSION debug="+d,exchange_partition_abort_1";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
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"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before crash
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
# State after crash recovery
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
DROP TABLE t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
DROP TABLE t2;
SET SESSION debug="-d,exchange_partition_abort_1";
SET SESSION debug="+d,exchange_partition_abort_2";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
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"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before crash
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
# State after crash recovery
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
DROP TABLE t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
DROP TABLE t2;
SET SESSION debug="-d,exchange_partition_abort_2";
SET SESSION debug="+d,exchange_partition_abort_3";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
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"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before crash
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
# State after crash recovery
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
DROP TABLE t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
DROP TABLE t2;
SET SESSION debug="-d,exchange_partition_abort_3";
SET SESSION debug="+d,exchange_partition_abort_4";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
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"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before crash
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sqlx-nnnn_nnnn.ibd
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
# State after crash recovery
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
DROP TABLE t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
DROP TABLE t2;
SET SESSION debug="-d,exchange_partition_abort_4";
SET SESSION debug="+d,exchange_partition_abort_5";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
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"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before crash
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sqlx-nnnn_nnnn.ibd
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
# State after crash recovery
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
DROP TABLE t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
DROP TABLE t2;
SET SESSION debug="-d,exchange_partition_abort_5";
SET SESSION debug="+d,exchange_partition_abort_6";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
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"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before crash
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sqlx-nnnn_nnnn.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
# State after crash recovery
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
DROP TABLE t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
DROP TABLE t2;
SET SESSION debug="-d,exchange_partition_abort_6";
SET SESSION debug="+d,exchange_partition_abort_7";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
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"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before crash
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sqlx-nnnn_nnnn.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
# State after crash recovery
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
DROP TABLE t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
DROP TABLE t2;
SET SESSION debug="-d,exchange_partition_abort_7";
SET SESSION debug="+d,exchange_partition_abort_8";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
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"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before crash
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
# State after crash recovery
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
DROP TABLE t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
DROP TABLE t2;
SET SESSION debug="-d,exchange_partition_abort_8";
SET SESSION debug="+d,exchange_partition_abort_9";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
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"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before crash
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
# State after crash recovery
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
SELECT * FROM t1;
a	b
11	Original from partition p1
12	Original from partition p1
13	Original from partition p1
14	Original from partition p1
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
DROP TABLE t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
1	Original from partition p0
2	Original from partition p0
3	Original from partition p0
4	Original from partition p0
DROP TABLE t2;
SET SESSION debug="-d,exchange_partition_abort_9";
SET SESSION debug="+d,exchange_partition_fail_1";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
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"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before failure
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
# State after failure
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
DROP TABLE t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
DROP TABLE t2;
SET SESSION debug="-d,exchange_partition_fail_1";
SET SESSION debug="+d,exchange_partition_fail_2";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
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"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before failure
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
# State after failure
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
DROP TABLE t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
DROP TABLE t2;
SET SESSION debug="-d,exchange_partition_fail_2";
SET SESSION debug="+d,exchange_partition_fail_3";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
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"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before failure
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error on rename of './test/t2' to './test/#sqlx-nnnn_nnnn' (errno: 0 - n/a)
# State after failure
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
DROP TABLE t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
DROP TABLE t2;
SET SESSION debug="-d,exchange_partition_fail_3";
SET SESSION debug="+d,exchange_partition_fail_4";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
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"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before failure
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
# State after failure
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
DROP TABLE t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
DROP TABLE t2;
SET SESSION debug="-d,exchange_partition_fail_4";
SET SESSION debug="+d,exchange_partition_fail_5";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
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"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before failure
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error on rename of './test/t1#P#p0' to './test/t2' (errno: 0 - n/a)
# State after failure
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
DROP TABLE t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
DROP TABLE t2;
SET SESSION debug="-d,exchange_partition_fail_5";
SET SESSION debug="+d,exchange_partition_fail_6";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
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"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before failure
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
# State after failure
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
DROP TABLE t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
DROP TABLE t2;
SET SESSION debug="-d,exchange_partition_fail_6";
SET SESSION debug="+d,exchange_partition_fail_7";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
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"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before failure
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error on rename of './test/#sqlx-nnnn_nnnn' to './test/t1#P#p0' (errno: 0 - n/a)
# State after failure
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
DROP TABLE t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
DROP TABLE t2;
SET SESSION debug="-d,exchange_partition_fail_7";
SET SESSION debug="+d,exchange_partition_fail_8";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
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"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before failure
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
# State after failure
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
DROP TABLE t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
DROP TABLE t2;
SET SESSION debug="-d,exchange_partition_fail_8";
SET SESSION debug="+d,exchange_partition_fail_9";
CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
CREATE TABLE t1 (a INT, b VARCHAR(64))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p1 VALUES LESS THAN MAXVALUE);
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"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
# State before failure
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE 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
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
3	Original from partition p0
4	Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
# State after failure
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t2.frm
t2.ibd
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 RANGE (a)
(PARTITION p0 VALUES LESS THAN (10) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
SELECT * FROM t1;
a	b
11	Original from partition p1
12	Original from partition p1
13	Original from partition p1
14	Original from partition p1
21	Original from partition p1
22	Original from partition p1
23	Original from partition p1
24	Original from partition p1
5	Original from table t2
6	Original from table t2
7	Original from table t2
8	Original from table t2
DROP TABLE t1;
SHOW CREATE TABLE t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` int(11) DEFAULT NULL,
  `b` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t2;
a	b
1	Original from partition p0
2	Original from partition p0
3	Original from partition p0
4	Original from partition p0
DROP TABLE t2;
SET SESSION debug="-d,exchange_partition_fail_9";
# Test ALTER TABLE t1 UPGRADE PARTITIONING
SET SESSION debug="+d,crash_upgrade_partition_1";
CREATE TABLE t575 (a int PRIMARY KEY, b varchar(63))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION p1 VALUES LESS THAN (200),
PARTITION pmax VALUES LESS THAN MAXVALUE);
INSERT INTO t575 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
UPDATE t575 SET b = CONCAT("Filler_", a);
INSERT INTO t575 SELECT a + 100, CONCAT("Filler_", a + 100) FROM t575;
INSERT INTO t575 SELECT a + 200, CONCAT("Filler_", a + 200) FROM t575;
RENAME TABLE t575 TO t1;
# Flush out the old table definition so it can be replaced
FLUSH TABLE t1;
# Replace the .frm and copy a .par file, so it is the same as a 5.7.5
# table. InnoDB internals is the same. Notice char(64) instead of (63)!
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
UNLOCK TABLES;
# State before crash
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
ALTER TABLE t1 UPGRADE PARTITIONING;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
# State after crash recovery
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
# Verifying that the data files is the same
DROP TABLE t1;
SET SESSION debug="-d,crash_upgrade_partition_1";
SET SESSION debug="+d,crash_upgrade_partition_2";
CREATE TABLE t575 (a int PRIMARY KEY, b varchar(63))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION p1 VALUES LESS THAN (200),
PARTITION pmax VALUES LESS THAN MAXVALUE);
INSERT INTO t575 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
UPDATE t575 SET b = CONCAT("Filler_", a);
INSERT INTO t575 SELECT a + 100, CONCAT("Filler_", a + 100) FROM t575;
INSERT INTO t575 SELECT a + 200, CONCAT("Filler_", a + 200) FROM t575;
RENAME TABLE t575 TO t1;
# Flush out the old table definition so it can be replaced
FLUSH TABLE t1;
# Replace the .frm and copy a .par file, so it is the same as a 5.7.5
# table. InnoDB internals is the same. Notice char(64) instead of (63)!
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
UNLOCK TABLES;
# State before crash
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
ALTER TABLE t1 UPGRADE PARTITIONING;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
# State after crash recovery
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
# Verifying that the data files is the same
DROP TABLE t1;
SET SESSION debug="-d,crash_upgrade_partition_2";
SET SESSION debug="+d,crash_upgrade_partition_3";
CREATE TABLE t575 (a int PRIMARY KEY, b varchar(63))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION p1 VALUES LESS THAN (200),
PARTITION pmax VALUES LESS THAN MAXVALUE);
INSERT INTO t575 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
UPDATE t575 SET b = CONCAT("Filler_", a);
INSERT INTO t575 SELECT a + 100, CONCAT("Filler_", a + 100) FROM t575;
INSERT INTO t575 SELECT a + 200, CONCAT("Filler_", a + 200) FROM t575;
RENAME TABLE t575 TO t1;
# Flush out the old table definition so it can be replaced
FLUSH TABLE t1;
# Replace the .frm and copy a .par file, so it is the same as a 5.7.5
# table. InnoDB internals is the same. Notice char(64) instead of (63)!
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
UNLOCK TABLES;
# State before crash
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
ALTER TABLE t1 UPGRADE PARTITIONING;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
# State after crash recovery
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
# Verifying that the data files is the same
DROP TABLE t1;
SET SESSION debug="-d,crash_upgrade_partition_3";
SET SESSION debug="+d,crash_upgrade_partition_4";
CREATE TABLE t575 (a int PRIMARY KEY, b varchar(63))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION p1 VALUES LESS THAN (200),
PARTITION pmax VALUES LESS THAN MAXVALUE);
INSERT INTO t575 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
UPDATE t575 SET b = CONCAT("Filler_", a);
INSERT INTO t575 SELECT a + 100, CONCAT("Filler_", a + 100) FROM t575;
INSERT INTO t575 SELECT a + 200, CONCAT("Filler_", a + 200) FROM t575;
RENAME TABLE t575 TO t1;
# Flush out the old table definition so it can be replaced
FLUSH TABLE t1;
# Replace the .frm and copy a .par file, so it is the same as a 5.7.5
# table. InnoDB internals is the same. Notice char(64) instead of (63)!
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
UNLOCK TABLES;
# State before crash
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
ALTER TABLE t1 UPGRADE PARTITIONING;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
# State after crash recovery
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
# Verifying that the data files is the same
DROP TABLE t1;
SET SESSION debug="-d,crash_upgrade_partition_4";
SET SESSION debug="+d,crash_upgrade_partition_5";
CREATE TABLE t575 (a int PRIMARY KEY, b varchar(63))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION p1 VALUES LESS THAN (200),
PARTITION pmax VALUES LESS THAN MAXVALUE);
INSERT INTO t575 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
UPDATE t575 SET b = CONCAT("Filler_", a);
INSERT INTO t575 SELECT a + 100, CONCAT("Filler_", a + 100) FROM t575;
INSERT INTO t575 SELECT a + 200, CONCAT("Filler_", a + 200) FROM t575;
RENAME TABLE t575 TO t1;
# Flush out the old table definition so it can be replaced
FLUSH TABLE t1;
# Replace the .frm and copy a .par file, so it is the same as a 5.7.5
# table. InnoDB internals is the same. Notice char(64) instead of (63)!
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
UNLOCK TABLES;
# State before crash
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
ALTER TABLE t1 UPGRADE PARTITIONING;
ERROR HY000: Lost connection to MySQL server during query
# State after crash (before recovery)
#sql-t1.frm
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
# State after crash recovery
found 3 *.ibd file(s)
.frm created by version >= 5.7.8
DB_TYPE (byte 3): 12
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'InnoDB'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
# Verifying that the data files is the same
DROP TABLE t1;
SET SESSION debug="-d,crash_upgrade_partition_5";
# Error recovery for ALTER TABLE t UPGRADE PARTITIONING
SET SESSION debug="+d,fail_upgrade_partition_1";
CREATE TABLE t575 (a int PRIMARY KEY, b varchar(63))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION p1 VALUES LESS THAN (200),
PARTITION pmax VALUES LESS THAN MAXVALUE);
INSERT INTO t575 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
UPDATE t575 SET b = CONCAT("Filler_", a);
INSERT INTO t575 SELECT a + 100, CONCAT("Filler_", a + 100) FROM t575;
INSERT INTO t575 SELECT a + 200, CONCAT("Filler_", a + 200) FROM t575;
RENAME TABLE t575 TO t1;
# Flush out the old table definition so it can be replaced
FLUSH TABLE t1;
# Replace the .frm and copy a .par file, so it is the same as a 5.7.5
# table. InnoDB internals is the same. Notice char(64) instead of (63)!
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
UNLOCK TABLES;
# State before failure
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
ALTER TABLE t1 UPGRADE PARTITIONING;
ERROR HY000: Unknown error
# State after failure
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
# Verifying that the data files is the same
DROP TABLE t1;
# Same test under LOCK TABLE
CREATE TABLE t575 (a int PRIMARY KEY, b varchar(63))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION p1 VALUES LESS THAN (200),
PARTITION pmax VALUES LESS THAN MAXVALUE);
INSERT INTO t575 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
UPDATE t575 SET b = CONCAT("Filler_", a);
INSERT INTO t575 SELECT a + 100, CONCAT("Filler_", a + 100) FROM t575;
INSERT INTO t575 SELECT a + 200, CONCAT("Filler_", a + 200) FROM t575;
RENAME TABLE t575 TO t1;
# Flush out the old table definition so it can be replaced
FLUSH TABLE t1;
# Replace the .frm and copy a .par file, so it is the same as a 5.7.5
# table. InnoDB internals is the same. Notice char(64) instead of (63)!
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
UNLOCK TABLES;
# State before failure
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
LOCK TABLE t1 WRITE;
ALTER TABLE t1 UPGRADE PARTITIONING;
ERROR HY000: Unknown error
# State after failure
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
UNLOCK TABLES;
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
# Verifying that the data files is the same
DROP TABLE t1;
SET SESSION debug="-d,fail_upgrade_partition_1";
SET SESSION debug="+d,fail_upgrade_partition_2";
CREATE TABLE t575 (a int PRIMARY KEY, b varchar(63))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION p1 VALUES LESS THAN (200),
PARTITION pmax VALUES LESS THAN MAXVALUE);
INSERT INTO t575 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
UPDATE t575 SET b = CONCAT("Filler_", a);
INSERT INTO t575 SELECT a + 100, CONCAT("Filler_", a + 100) FROM t575;
INSERT INTO t575 SELECT a + 200, CONCAT("Filler_", a + 200) FROM t575;
RENAME TABLE t575 TO t1;
# Flush out the old table definition so it can be replaced
FLUSH TABLE t1;
# Replace the .frm and copy a .par file, so it is the same as a 5.7.5
# table. InnoDB internals is the same. Notice char(64) instead of (63)!
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
UNLOCK TABLES;
# State before failure
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
ALTER TABLE t1 UPGRADE PARTITIONING;
ERROR HY000: Unknown error
# State after failure
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
# Verifying that the data files is the same
DROP TABLE t1;
# Same test under LOCK TABLE
CREATE TABLE t575 (a int PRIMARY KEY, b varchar(63))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION p1 VALUES LESS THAN (200),
PARTITION pmax VALUES LESS THAN MAXVALUE);
INSERT INTO t575 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
UPDATE t575 SET b = CONCAT("Filler_", a);
INSERT INTO t575 SELECT a + 100, CONCAT("Filler_", a + 100) FROM t575;
INSERT INTO t575 SELECT a + 200, CONCAT("Filler_", a + 200) FROM t575;
RENAME TABLE t575 TO t1;
# Flush out the old table definition so it can be replaced
FLUSH TABLE t1;
# Replace the .frm and copy a .par file, so it is the same as a 5.7.5
# table. InnoDB internals is the same. Notice char(64) instead of (63)!
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
UNLOCK TABLES;
# State before failure
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
LOCK TABLE t1 WRITE;
ALTER TABLE t1 UPGRADE PARTITIONING;
ERROR HY000: Unknown error
# State after failure
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
UNLOCK TABLES;
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
# Verifying that the data files is the same
DROP TABLE t1;
SET SESSION debug="-d,fail_upgrade_partition_2";
SET SESSION debug="+d,fail_upgrade_partition_3";
CREATE TABLE t575 (a int PRIMARY KEY, b varchar(63))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION p1 VALUES LESS THAN (200),
PARTITION pmax VALUES LESS THAN MAXVALUE);
INSERT INTO t575 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
UPDATE t575 SET b = CONCAT("Filler_", a);
INSERT INTO t575 SELECT a + 100, CONCAT("Filler_", a + 100) FROM t575;
INSERT INTO t575 SELECT a + 200, CONCAT("Filler_", a + 200) FROM t575;
RENAME TABLE t575 TO t1;
# Flush out the old table definition so it can be replaced
FLUSH TABLE t1;
# Replace the .frm and copy a .par file, so it is the same as a 5.7.5
# table. InnoDB internals is the same. Notice char(64) instead of (63)!
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
UNLOCK TABLES;
# State before failure
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
ALTER TABLE t1 UPGRADE PARTITIONING;
ERROR HY000: Unknown error
# State after failure
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
# Verifying that the data files is the same
DROP TABLE t1;
# Same test under LOCK TABLE
CREATE TABLE t575 (a int PRIMARY KEY, b varchar(63))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION p1 VALUES LESS THAN (200),
PARTITION pmax VALUES LESS THAN MAXVALUE);
INSERT INTO t575 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
UPDATE t575 SET b = CONCAT("Filler_", a);
INSERT INTO t575 SELECT a + 100, CONCAT("Filler_", a + 100) FROM t575;
INSERT INTO t575 SELECT a + 200, CONCAT("Filler_", a + 200) FROM t575;
RENAME TABLE t575 TO t1;
# Flush out the old table definition so it can be replaced
FLUSH TABLE t1;
# Replace the .frm and copy a .par file, so it is the same as a 5.7.5
# table. InnoDB internals is the same. Notice char(64) instead of (63)!
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
UNLOCK TABLES;
# State before failure
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
LOCK TABLE t1 WRITE;
ALTER TABLE t1 UPGRADE PARTITIONING;
ERROR HY000: Unknown error
# State after failure
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
UNLOCK TABLES;
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
# Verifying that the data files is the same
DROP TABLE t1;
SET SESSION debug="-d,fail_upgrade_partition_3";
SET SESSION debug="+d,fail_upgrade_partition_4";
CREATE TABLE t575 (a int PRIMARY KEY, b varchar(63))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION p1 VALUES LESS THAN (200),
PARTITION pmax VALUES LESS THAN MAXVALUE);
INSERT INTO t575 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
UPDATE t575 SET b = CONCAT("Filler_", a);
INSERT INTO t575 SELECT a + 100, CONCAT("Filler_", a + 100) FROM t575;
INSERT INTO t575 SELECT a + 200, CONCAT("Filler_", a + 200) FROM t575;
RENAME TABLE t575 TO t1;
# Flush out the old table definition so it can be replaced
FLUSH TABLE t1;
# Replace the .frm and copy a .par file, so it is the same as a 5.7.5
# table. InnoDB internals is the same. Notice char(64) instead of (63)!
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
UNLOCK TABLES;
# State before failure
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
ALTER TABLE t1 UPGRADE PARTITIONING;
ERROR HY000: Unknown error
# State after failure
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
# Verifying that the data files is the same
DROP TABLE t1;
# Same test under LOCK TABLE
CREATE TABLE t575 (a int PRIMARY KEY, b varchar(63))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION p1 VALUES LESS THAN (200),
PARTITION pmax VALUES LESS THAN MAXVALUE);
INSERT INTO t575 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
UPDATE t575 SET b = CONCAT("Filler_", a);
INSERT INTO t575 SELECT a + 100, CONCAT("Filler_", a + 100) FROM t575;
INSERT INTO t575 SELECT a + 200, CONCAT("Filler_", a + 200) FROM t575;
RENAME TABLE t575 TO t1;
# Flush out the old table definition so it can be replaced
FLUSH TABLE t1;
# Replace the .frm and copy a .par file, so it is the same as a 5.7.5
# table. InnoDB internals is the same. Notice char(64) instead of (63)!
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
UNLOCK TABLES;
# State before failure
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
LOCK TABLE t1 WRITE;
ALTER TABLE t1 UPGRADE PARTITIONING;
ERROR HY000: Unknown error
# State after failure
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
UNLOCK TABLES;
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
# Verifying that the data files is the same
DROP TABLE t1;
SET SESSION debug="-d,fail_upgrade_partition_4";
SET SESSION debug="+d,fail_upgrade_partition_5";
CREATE TABLE t575 (a int PRIMARY KEY, b varchar(63))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION p1 VALUES LESS THAN (200),
PARTITION pmax VALUES LESS THAN MAXVALUE);
INSERT INTO t575 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
UPDATE t575 SET b = CONCAT("Filler_", a);
INSERT INTO t575 SELECT a + 100, CONCAT("Filler_", a + 100) FROM t575;
INSERT INTO t575 SELECT a + 200, CONCAT("Filler_", a + 200) FROM t575;
RENAME TABLE t575 TO t1;
# Flush out the old table definition so it can be replaced
FLUSH TABLE t1;
# Replace the .frm and copy a .par file, so it is the same as a 5.7.5
# table. InnoDB internals is the same. Notice char(64) instead of (63)!
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
UNLOCK TABLES;
# State before failure
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
ALTER TABLE t1 UPGRADE PARTITIONING;
ERROR HY000: Unknown error
# State after failure
found 3 *.ibd file(s)
.frm created by version >= 5.7.8
DB_TYPE (byte 3): 12
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'InnoDB'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
# Verifying that the data files is the same
DROP TABLE t1;
# Same test under LOCK TABLE
CREATE TABLE t575 (a int PRIMARY KEY, b varchar(63))
ENGINE = InnoDB
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION p1 VALUES LESS THAN (200),
PARTITION pmax VALUES LESS THAN MAXVALUE);
INSERT INTO t575 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
UPDATE t575 SET b = CONCAT("Filler_", a);
INSERT INTO t575 SELECT a + 100, CONCAT("Filler_", a + 100) FROM t575;
INSERT INTO t575 SELECT a + 200, CONCAT("Filler_", a + 200) FROM t575;
RENAME TABLE t575 TO t1;
# Flush out the old table definition so it can be replaced
FLUSH TABLE t1;
# Replace the .frm and copy a .par file, so it is the same as a 5.7.5
# table. InnoDB internals is the same. Notice char(64) instead of (63)!
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
UNLOCK TABLES;
# State before failure
found 3 *.ibd file(s)
.par file exists
.frm created by version: 50705
DB_TYPE (byte 3): 20
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'partition'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
t1.par
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
Warnings:
Warning	1287	The partition engine, used by table 'test.t1', is deprecated and will be removed in a future release. Please use native partitioning instead.
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
LOCK TABLE t1 WRITE;
ALTER TABLE t1 UPGRADE PARTITIONING;
ERROR HY000: Unknown error
# State after failure
found 3 *.ibd file(s)
.frm created by version >= 5.7.8
DB_TYPE (byte 3): 12
DEFAULT_PART_DB_TYPE (byte 61): 12
DB_TYPE string: 'InnoDB'
list_t1_1.txt
t1#P#p0.ibd
t1#P#p1.ibd
t1#P#pmax.ibd
t1.frm
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (100) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (200) ENGINE = InnoDB,
 PARTITION pmax VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
SELECT * FROM t1;
a	b
1	Filler_1
10	Filler_10
101	Filler_101
102	Filler_102
103	Filler_103
104	Filler_104
105	Filler_105
106	Filler_106
107	Filler_107
108	Filler_108
109	Filler_109
110	Filler_110
2	Filler_2
201	Filler_201
202	Filler_202
203	Filler_203
204	Filler_204
205	Filler_205
206	Filler_206
207	Filler_207
208	Filler_208
209	Filler_209
210	Filler_210
3	Filler_3
301	Filler_301
302	Filler_302
303	Filler_303
304	Filler_304
305	Filler_305
306	Filler_306
307	Filler_307
308	Filler_308
309	Filler_309
310	Filler_310
4	Filler_4
5	Filler_5
6	Filler_6
7	Filler_7
8	Filler_8
9	Filler_9
UNLOCK TABLES;
# Flush the table data files to get deterministic checksum of data files
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
# Verifying that the data files is the same
DROP TABLE t1;
SET SESSION debug="-d,fail_upgrade_partition_5";

Man Man