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: MariaDB is trying to drop table ");
call mtr.add_suppression("table .* does not exist in the InnoDB internal");
#
# 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 @save_dbug=@@debug_dbug;
SET SESSION debug_dbug="+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 COLLATE=latin1_swedish_ci
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
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 server during query
# State after crash (before recovery)
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
t2.frm
t2.ibd
# State after crash recovery
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 COLLATE=latin1_swedish_ci
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_dbug=@save_dbug;
SET SESSION debug_dbug="+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 COLLATE=latin1_swedish_ci
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
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 server during query
# State after crash (before recovery)
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
t2.frm
t2.ibd
# State after crash recovery
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 COLLATE=latin1_swedish_ci
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_dbug=@save_dbug;
SET SESSION debug_dbug="+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 COLLATE=latin1_swedish_ci
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
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 server during query
# State after crash (before recovery)
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
t2.frm
t2.ibd
# State after crash recovery
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 COLLATE=latin1_swedish_ci
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_dbug=@save_dbug;
SET SESSION debug_dbug="+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 COLLATE=latin1_swedish_ci
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
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 server during query
# State after crash (before recovery)
#sql-exchange.frm
# State after crash recovery
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 COLLATE=latin1_swedish_ci
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_dbug=@save_dbug;
SET SESSION debug_dbug="+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 COLLATE=latin1_swedish_ci
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
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 server during query
# State after crash (before recovery)
#sql-exchange.frm
# State after crash recovery
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 COLLATE=latin1_swedish_ci
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_dbug=@save_dbug;
SET SESSION debug_dbug="+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 COLLATE=latin1_swedish_ci
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
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 server during query
# State after crash (before recovery)
#sql-exchange.ibd
# State after crash recovery
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 COLLATE=latin1_swedish_ci
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_dbug=@save_dbug;
SET SESSION debug_dbug="+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 COLLATE=latin1_swedish_ci
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
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 server during query
# State after crash (before recovery)
#sql-exchange.ibd
# State after crash recovery
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 COLLATE=latin1_swedish_ci
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_dbug=@save_dbug;
SET SESSION debug_dbug="+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 COLLATE=latin1_swedish_ci
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
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 server during query
# State after crash (before recovery)
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
t2.frm
t2.ibd
# State after crash recovery
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 COLLATE=latin1_swedish_ci
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_dbug=@save_dbug;
SET SESSION debug_dbug="+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 COLLATE=latin1_swedish_ci
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
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 server during query
# State after crash (before recovery)
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
t2.frm
t2.ibd
# State after crash recovery
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 COLLATE=latin1_swedish_ci
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_dbug=@save_dbug;
SET @save_dbug=@@debug_dbug;
SET SESSION debug_dbug="+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");
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");
# d,exchange_partition_fail_1: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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
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 COLLATE=latin1_swedish_ci
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
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
# d,exchange_partition_fail_1: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 COLLATE=latin1_swedish_ci
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_dbug=@save_dbug;
SET SESSION debug_dbug="+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");
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");
# d,exchange_partition_fail_2: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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
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 COLLATE=latin1_swedish_ci
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
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
# d,exchange_partition_fail_2: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 COLLATE=latin1_swedish_ci
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_dbug=@save_dbug;
SET SESSION debug_dbug="+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");
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");
# d,exchange_partition_fail_3: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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
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 COLLATE=latin1_swedish_ci
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
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error on rename of './test/t2' to './test/#sql-exchange' (errno: 0 "Internal error/check (Not system error)")
# d,exchange_partition_fail_3: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 COLLATE=latin1_swedish_ci
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_dbug=@save_dbug;
SET SESSION debug_dbug="+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");
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");
# d,exchange_partition_fail_4: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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
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 COLLATE=latin1_swedish_ci
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
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
# d,exchange_partition_fail_4: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 COLLATE=latin1_swedish_ci
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_dbug=@save_dbug;
SET SESSION debug_dbug="+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");
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");
# d,exchange_partition_fail_5: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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
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 COLLATE=latin1_swedish_ci
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
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error on rename of './test/t1#P#p0' to './test/t2' (errno: 0 "Internal error/check (Not system error)")
# d,exchange_partition_fail_5: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 COLLATE=latin1_swedish_ci
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_dbug=@save_dbug;
SET SESSION debug_dbug="+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");
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");
# d,exchange_partition_fail_6: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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
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 COLLATE=latin1_swedish_ci
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
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
# d,exchange_partition_fail_6: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 COLLATE=latin1_swedish_ci
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_dbug=@save_dbug;
SET SESSION debug_dbug="+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");
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");
# d,exchange_partition_fail_7: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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
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 COLLATE=latin1_swedish_ci
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
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error on rename of './test/#sql-exchange' to './test/t1#P#p0' (errno: 0 "Internal error/check (Not system error)")
# d,exchange_partition_fail_7: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 COLLATE=latin1_swedish_ci
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_dbug=@save_dbug;
SET SESSION debug_dbug="+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");
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");
# d,exchange_partition_fail_8: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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
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 COLLATE=latin1_swedish_ci
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
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
# d,exchange_partition_fail_8: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 COLLATE=latin1_swedish_ci
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_dbug=@save_dbug;
SET SESSION debug_dbug="+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");
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");
# d,exchange_partition_fail_9: BEFORE failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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
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 COLLATE=latin1_swedish_ci
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
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
ERROR HY000: Error in DDL log
# d,exchange_partition_fail_9: AFTER failure
db.opt
t1#P#p0.ibd
t1#P#p1.ibd
t1.frm
t1.par
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 COLLATE=latin1_swedish_ci
 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 COLLATE=latin1_swedish_ci
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_dbug=@save_dbug;
