List:Commits« Previous MessageNext Message »
From:Mattias Jonsson Date:August 13 2010 7:50am
Subject:bzr commit into mysql-5.5-bugfixing branch (mattias.jonsson:3174) Bug#53676
Bug#53770
View as plain text  
#At file:///Users/mattiasj/mysql-bzr/b53676-5.5-bf/ based on revid:jonathan.perkin@stripped

 3174 Mattias Jonsson	2010-08-13
      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
      
      5.5 fix for:
      Bug#51042: REORGANIZE PARTITION can leave table in an
                 inconsistent state in case of crash
      Needs to be back-ported to 5.1
      
      5.5 fix for:
      Bug#50418: DROP PARTITION does not interact with
                 transactions
      
      Main problem was non-persistent operations done
      before meta-data lock was taken (53770+53676).
      And 53676 needed to keep the table/partitions opened and locked
      while copying the data to the new partitions.
      
      Also added thorough tests to spot some additional bugs
      in the ddl_log code, which could result in bad state
      between the .frm and partitions.
      
      Collapsed patch, includes all fixes required from the reviewers.
     @ mysql-test/r/partition_innodb.result
        updated result with new test
     @ mysql-test/suite/parts/inc/partition_crash.inc
        crash test include file
     @ mysql-test/suite/parts/inc/partition_crash_add.inc
        test all states in fast_alter_partition_table
        ADD PARTITION branch
     @ mysql-test/suite/parts/inc/partition_crash_change.inc
        test all states in fast_alter_partition_table
        CHANGE PARTITION branch
     @ mysql-test/suite/parts/inc/partition_crash_drop.inc
        test all states in fast_alter_partition_table
        DROP PARTITION branch
     @ mysql-test/suite/parts/inc/partition_fail.inc
        recovery test including injecting errors
     @ mysql-test/suite/parts/inc/partition_fail_add.inc
        test all states in fast_alter_partition_table
        ADD PARTITION branch
     @ mysql-test/suite/parts/inc/partition_fail_change.inc
        test all states in fast_alter_partition_table
        CHANGE PARTITION branch
     @ mysql-test/suite/parts/inc/partition_fail_drop.inc
        test all states in fast_alter_partition_table
        DROP PARTITION branch
     @ mysql-test/suite/parts/inc/partition_mgm_crash.inc
        include file that runs all crash and failure injection tests.
     @ mysql-test/suite/parts/r/partition_debug_innodb.result
        new test result file
     @ mysql-test/suite/parts/r/partition_debug_myisam.result
        new test result file
     @ mysql-test/suite/parts/r/partition_special_innodb.result
        updated result
     @ mysql-test/suite/parts/r/partition_special_myisam.result
        updated result
     @ mysql-test/suite/parts/t/partition_debug_innodb-master.opt
        opt file for using with crashing tests of partitioned innodb
     @ mysql-test/suite/parts/t/partition_debug_innodb.test
        partitioned innodb test that require debug builds
     @ mysql-test/suite/parts/t/partition_debug_myisam-master.opt
        opt file for using with crashing tests of partitioned myisam
     @ mysql-test/suite/parts/t/partition_debug_myisam.test
        partitioned myisam test that require debug builds
     @ mysql-test/suite/parts/t/partition_special_innodb-master.opt
        added innodb-file-per-table to easier verify partition status on disk
     @ mysql-test/suite/parts/t/partition_special_innodb.test
        added test case
     @ mysql-test/suite/parts/t/partition_special_myisam.test
        added test case
     @ mysql-test/t/partition_innodb.test
        added test case
     @ sql/sql_base.cc
        Moved alter_close_tables to sql_partition.cc
     @ sql/sql_base.h
        removed some non existing and duplicated functions.
     @ sql/sql_partition.cc
        fast_alter_partition_table:
        Spletted abort_and_upgrad_lock_and_close_table
        to its parts (wait_while_table_is_used and
        alter_close_tables) and always have
        wait_while_table_is_used before any persistent
        operations (including logs, which will be executed
        on failure) and alter_close_tables after
        create/read/write operations and before
        drop operations.
        
        moved alter_close_tables here from sql_base.cc
        
        Added error injections for better test coverage.
        
        write_log_final_change_partition:
        fixed a log_entry linking bug (delete_frm was not
        linked to change/drop partition)
        and drop partition must be executed before
        change partition (change partition can rename a
        partition to an old name, like REORG p1 INTO (p1,p2).
        
        write_log_add_change_partition:
        need to use drop_frm first, and relinking that entry
        and reusing its execute entry.
     @ sql/sql_table.cc
        added initialization of next_active_log_entry.
     @ sql/table.h
        removed a duplicate declaration.

    added:
      mysql-test/suite/parts/inc/partition_crash.inc
      mysql-test/suite/parts/inc/partition_crash_add.inc
      mysql-test/suite/parts/inc/partition_crash_change.inc
      mysql-test/suite/parts/inc/partition_crash_drop.inc
      mysql-test/suite/parts/inc/partition_fail.inc
      mysql-test/suite/parts/inc/partition_fail_add.inc
      mysql-test/suite/parts/inc/partition_fail_change.inc
      mysql-test/suite/parts/inc/partition_fail_drop.inc
      mysql-test/suite/parts/inc/partition_mgm_crash.inc
      mysql-test/suite/parts/r/partition_debug_innodb.result
      mysql-test/suite/parts/r/partition_debug_myisam.result
      mysql-test/suite/parts/t/partition_debug_innodb-master.opt
      mysql-test/suite/parts/t/partition_debug_innodb.test
      mysql-test/suite/parts/t/partition_debug_myisam-master.opt
      mysql-test/suite/parts/t/partition_debug_myisam.test
    modified:
      mysql-test/r/partition_innodb.result
      mysql-test/suite/parts/r/partition_special_innodb.result
      mysql-test/suite/parts/r/partition_special_myisam.result
      mysql-test/suite/parts/t/partition_special_innodb-master.opt
      mysql-test/suite/parts/t/partition_special_innodb.test
      mysql-test/suite/parts/t/partition_special_myisam.test
      mysql-test/t/partition_innodb.test
      sql/sql_base.cc
      sql/sql_base.h
      sql/sql_partition.cc
      sql/sql_table.cc
      sql/table.h
=== modified file 'mysql-test/r/partition_innodb.result'
--- a/mysql-test/r/partition_innodb.result	2010-07-06 17:38:03 +0000
+++ b/mysql-test/r/partition_innodb.result	2010-08-13 07:50:25 +0000
@@ -1,5 +1,67 @@
 drop table if exists t1, t2;
 #
+# Bug#50418: DROP PARTITION does not interact with transactions
+#
+CREATE TABLE t1 (
+id INT AUTO_INCREMENT NOT NULL,
+name CHAR(50) NOT NULL,
+myDate DATE NOT NULL,
+PRIMARY KEY (id, myDate),
+INDEX idx_date (myDate)
+) ENGINE=InnoDB
+PARTITION BY RANGE ( TO_DAYS(myDate) ) (
+PARTITION p0 VALUES LESS THAN (734028),
+PARTITION p1 VALUES LESS THAN (734029),
+PARTITION p2 VALUES LESS THAN (734030),
+PARTITION p3 VALUES LESS THAN MAXVALUE
+) ;
+INSERT INTO t1 VALUES 
+(NULL, 'Lachlan', '2009-09-13'),
+(NULL, 'Clint', '2009-09-13'),
+(NULL, 'John', '2009-09-14'),
+(NULL, 'Dave', '2009-09-14'),
+(NULL, 'Jeremy', '2009-09-15'),
+(NULL, 'Scott', '2009-09-15'),
+(NULL, 'Jeff', '2009-09-16'),
+(NULL, 'Joe', '2009-09-16');
+SET AUTOCOMMIT=0;
+SELECT * FROM t1 FOR UPDATE;
+id	name	myDate
+1	Lachlan	2009-09-13
+2	Clint	2009-09-13
+3	John	2009-09-14
+4	Dave	2009-09-14
+5	Jeremy	2009-09-15
+6	Scott	2009-09-15
+7	Jeff	2009-09-16
+8	Joe	2009-09-16
+UPDATE t1 SET name = 'Mattias' WHERE id = 7;
+SELECT * FROM t1 WHERE id = 7;
+id	name	myDate
+7	Mattias	2009-09-16
+# Connection con1
+SET lock_wait_timeout = 1;
+# After the patch it will wait and fail on timeout.
+ALTER TABLE t1 DROP PARTITION p3;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SHOW WARNINGS;
+Level	Code	Message
+Error	1205	Lock wait timeout exceeded; try restarting transaction
+# Connection default
+SELECT * FROM t1;
+id	name	myDate
+1	Lachlan	2009-09-13
+2	Clint	2009-09-13
+3	John	2009-09-14
+4	Dave	2009-09-14
+5	Jeremy	2009-09-15
+6	Scott	2009-09-15
+7	Mattias	2009-09-16
+8	Joe	2009-09-16
+# No changes.
+COMMIT;
+DROP TABLE t1;
+#
 # Bug#51830: Incorrect partition pruning on range partition (regression)
 #
 CREATE TABLE t1 (a INT NOT NULL)

=== added file 'mysql-test/suite/parts/inc/partition_crash.inc'
--- a/mysql-test/suite/parts/inc/partition_crash.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/parts/inc/partition_crash.inc	2010-08-13 07:50:25 +0000
@@ -0,0 +1,28 @@
+# Include file to decrease test code duplication
+
+--eval $create_statement
+--eval $insert_statement
+--echo # State before crash
+--replace_result #p# #P#
+--list_files $DATADIR/test
+SHOW CREATE TABLE t1;
+--sorted_result
+SELECT * FROM t1;
+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--disable_reconnect
+# CR_SERVER_LOST
+--error 2013
+--eval $crash_statement
+--echo # State after crash (before recovery)
+--replace_regex /sqlx.*\./sqlx-nnnn_nnnn./ /#p#/#P#/
+--list_files $DATADIR/test
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+--echo # State after crash recovery
+--replace_result #p# #P#
+--list_files $DATADIR/test
+SHOW CREATE TABLE t1;
+--sorted_result
+SELECT * FROM t1;
+DROP TABLE t1;

=== added file 'mysql-test/suite/parts/inc/partition_crash_add.inc'
--- a/mysql-test/suite/parts/inc/partition_crash_add.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/parts/inc/partition_crash_add.inc	2010-08-13 07:50:25 +0000
@@ -0,0 +1,33 @@
+# To be used with partition mgm commands like
+# ALTER TABLE t1 ADD PARTITION (LIST/RANGE PARTITIONING).
+--echo # Crash testing ADD PARTITION
+SET SESSION debug="+d,crash_add_partition_1";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_1";
+SET SESSION debug="+d,crash_add_partition_2";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_2";
+SET SESSION debug="+d,crash_add_partition_3";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_3";
+SET SESSION debug="+d,crash_add_partition_4";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_4";
+SET SESSION debug="+d,crash_add_partition_5";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_5";
+SET SESSION debug="+d,crash_add_partition_6";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_6";
+SET SESSION debug="+d,crash_add_partition_7";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_7";
+SET SESSION debug="+d,crash_add_partition_8";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_8";
+SET SESSION debug="+d,crash_add_partition_9";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_9";
+SET SESSION debug="+d,crash_add_partition_10";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_add_partition_10";

=== added file 'mysql-test/suite/parts/inc/partition_crash_change.inc'
--- a/mysql-test/suite/parts/inc/partition_crash_change.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/parts/inc/partition_crash_change.inc	2010-08-13 07:50:25 +0000
@@ -0,0 +1,40 @@
+# To be used with partition mgm commands like
+# ALTER TABLE t1 COALESCE/REBUILD/REORGANIZE PARTITION.
+--echo # Test change partition (REORGANIZE/REBUILD/COALESCE
+--echo # or ADD HASH PARTITION).
+SET SESSION debug="+d,crash_change_partition_1";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_1";
+SET SESSION debug="+d,crash_change_partition_2";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_2";
+SET SESSION debug="+d,crash_change_partition_3";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_3";
+SET SESSION debug="+d,crash_change_partition_4";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_4";
+SET SESSION debug="+d,crash_change_partition_5";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_5";
+SET SESSION debug="+d,crash_change_partition_6";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_6";
+SET SESSION debug="+d,crash_change_partition_7";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_7";
+SET SESSION debug="+d,crash_change_partition_8";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_8";
+SET SESSION debug="+d,crash_change_partition_9";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_9";
+SET SESSION debug="+d,crash_change_partition_10";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_10";
+SET SESSION debug="+d,crash_change_partition_11";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_11";
+SET SESSION debug="+d,crash_change_partition_12";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_change_partition_12";

=== added file 'mysql-test/suite/parts/inc/partition_crash_drop.inc'
--- a/mysql-test/suite/parts/inc/partition_crash_drop.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/parts/inc/partition_crash_drop.inc	2010-08-13 07:50:25 +0000
@@ -0,0 +1,30 @@
+# To be used with partition mgm commands like
+# ALTER TABLE t1 DROP PARTITION.
+--echo # Test DROP PARTITION
+SET SESSION debug="+d,crash_drop_partition_1";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_drop_partition_1";
+SET SESSION debug="+d,crash_drop_partition_2";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_drop_partition_2";
+SET SESSION debug="+d,crash_drop_partition_3";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_drop_partition_3";
+SET SESSION debug="+d,crash_drop_partition_4";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_drop_partition_4";
+SET SESSION debug="+d,crash_drop_partition_5";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_drop_partition_5";
+SET SESSION debug="+d,crash_drop_partition_6";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_drop_partition_6";
+SET SESSION debug="+d,crash_drop_partition_7";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_drop_partition_7";
+SET SESSION debug="+d,crash_drop_partition_8";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_drop_partition_8";
+SET SESSION debug="+d,crash_drop_partition_9";
+--source suite/parts/inc/partition_crash.inc
+SET SESSION debug="-d,crash_drop_partition_9";

=== added file 'mysql-test/suite/parts/inc/partition_fail.inc'
--- a/mysql-test/suite/parts/inc/partition_fail.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/parts/inc/partition_fail.inc	2010-08-13 07:50:25 +0000
@@ -0,0 +1,18 @@
+# Include file to decrease test code duplication
+
+--eval $create_statement
+--eval $insert_statement
+--echo # State before failure
+--list_files $DATADIR/test
+SHOW CREATE TABLE t1;
+--sorted_result
+SELECT * FROM t1;
+--disable_abort_on_error
+--eval $fail_statement
+--enable_abort_on_error
+--echo # State after failure
+--list_files $DATADIR/test
+SHOW CREATE TABLE t1;
+--sorted_result
+SELECT * FROM t1;
+DROP TABLE t1;

=== added file 'mysql-test/suite/parts/inc/partition_fail_add.inc'
--- a/mysql-test/suite/parts/inc/partition_fail_add.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/parts/inc/partition_fail_add.inc	2010-08-13 07:50:25 +0000
@@ -0,0 +1,33 @@
+# To be used with partition mgm commands like
+# ALTER TABLE t1 ADD PARTITION (LIST/RANGE PARTITIONING).
+--echo # Error recovery testing ADD PARTITION
+SET SESSION debug="+d,fail_add_partition_1";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_1";
+SET SESSION debug="+d,fail_add_partition_2";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_2";
+SET SESSION debug="+d,fail_add_partition_3";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_3";
+SET SESSION debug="+d,fail_add_partition_4";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_4";
+SET SESSION debug="+d,fail_add_partition_5";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_5";
+SET SESSION debug="+d,fail_add_partition_6";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_6";
+SET SESSION debug="+d,fail_add_partition_7";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_7";
+SET SESSION debug="+d,fail_add_partition_8";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_8";
+SET SESSION debug="+d,fail_add_partition_9";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_9";
+SET SESSION debug="+d,fail_add_partition_10";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_add_partition_10";

=== added file 'mysql-test/suite/parts/inc/partition_fail_change.inc'
--- a/mysql-test/suite/parts/inc/partition_fail_change.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/parts/inc/partition_fail_change.inc	2010-08-13 07:50:25 +0000
@@ -0,0 +1,40 @@
+# To be used with partition mgm commands like
+# ALTER TABLE t1 COALESCE/REBUILD/REORGANIZE PARTITION.
+--echo # Error recovery change partition (REORGANIZE/REBUILD/COALESCE
+--echo # or ADD HASH PARTITION).
+SET SESSION debug="+d,fail_change_partition_1";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_1";
+SET SESSION debug="+d,fail_change_partition_2";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_2";
+SET SESSION debug="+d,fail_change_partition_3";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_3";
+SET SESSION debug="+d,fail_change_partition_4";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_4";
+SET SESSION debug="+d,fail_change_partition_5";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_5";
+SET SESSION debug="+d,fail_change_partition_6";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_6";
+SET SESSION debug="+d,fail_change_partition_7";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_7";
+SET SESSION debug="+d,fail_change_partition_8";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_8";
+SET SESSION debug="+d,fail_change_partition_9";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_9";
+SET SESSION debug="+d,fail_change_partition_10";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_10";
+SET SESSION debug="+d,fail_change_partition_11";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_11";
+SET SESSION debug="+d,fail_change_partition_12";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_change_partition_12";

=== added file 'mysql-test/suite/parts/inc/partition_fail_drop.inc'
--- a/mysql-test/suite/parts/inc/partition_fail_drop.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/parts/inc/partition_fail_drop.inc	2010-08-13 07:50:25 +0000
@@ -0,0 +1,30 @@
+# To be used with partition mgm commands like
+# ALTER TABLE t1 DROP PARTITION.
+--echo # Error recovery DROP PARTITION
+SET SESSION debug="+d,fail_drop_partition_1";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_drop_partition_1";
+SET SESSION debug="+d,fail_drop_partition_2";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_drop_partition_2";
+SET SESSION debug="+d,fail_drop_partition_3";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_drop_partition_3";
+SET SESSION debug="+d,fail_drop_partition_4";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_drop_partition_4";
+SET SESSION debug="+d,fail_drop_partition_5";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_drop_partition_5";
+SET SESSION debug="+d,fail_drop_partition_6";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_drop_partition_6";
+SET SESSION debug="+d,fail_drop_partition_7";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_drop_partition_7";
+SET SESSION debug="+d,fail_drop_partition_8";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_drop_partition_8";
+SET SESSION debug="+d,fail_drop_partition_9";
+--source suite/parts/inc/partition_fail.inc
+SET SESSION debug="-d,fail_drop_partition_9";

=== added file 'mysql-test/suite/parts/inc/partition_mgm_crash.inc'
--- a/mysql-test/suite/parts/inc/partition_mgm_crash.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/parts/inc/partition_mgm_crash.inc	2010-08-13 07:50:25 +0000
@@ -0,0 +1,34 @@
+# collection of tests which crashes the server and checks recovery.
+# also using error injection to test recovery of failures.
+# uses $DATADIR and $engine
+
+--echo #
+--echo # Bug#53676: Unexpected errors and possible table corruption on
+--echo # ADD PARTITION and LOCK TABLE
+--echo # Bug#53770: Server crash at handler.cc:2076 on LOAD DATA
+--echo # after timed out COALESCE PARTITION
+--echo # Extended crash recovery testing of fast_alter_partition_table.
+call mtr.add_suppression("Attempting backtrace. You can use the following information to find out");
+
+let $create_statement= CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = $engine
+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));
+let $insert_statement= 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");
+
+let $crash_statement= ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+--source suite/parts/inc/partition_crash_add.inc
+let $fail_statement= $crash_statement;
+--source suite/parts/inc/partition_fail_add.inc
+let $crash_statement= ALTER TABLE t1 DROP PARTITION p10;
+--source suite/parts/inc/partition_crash_drop.inc
+let $fail_statement= $crash_statement;
+--source suite/parts/inc/partition_fail_drop.inc
+let $crash_statement= 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));
+--source suite/parts/inc/partition_crash_change.inc
+let $fail_statement= $crash_statement;
+--source suite/parts/inc/partition_fail_change.inc

=== added file 'mysql-test/suite/parts/r/partition_debug_innodb.result'
--- a/mysql-test/suite/parts/r/partition_debug_innodb.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/parts/r/partition_debug_innodb.result	2010-08-13 07:50:25 +0000
@@ -0,0 +1,3923 @@
+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");
+# 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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_7";
+SET SESSION debug="+d,crash_add_partition_8";
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+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_8";
+SET SESSION debug="+d,crash_add_partition_9";
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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#P#p20.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+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_9";
+SET SESSION debug="+d,crash_add_partition_10";
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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#P#p20.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+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_10";
+# 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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_7";
+SET SESSION debug="+d,fail_add_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_8";
+SET SESSION debug="+d,fail_add_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_9";
+SET SESSION debug="+d,fail_add_partition_10";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_10";
+# 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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_5";
+SET SESSION debug="+d,crash_drop_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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_6";
+SET SESSION debug="+d,crash_drop_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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_7";
+SET SESSION debug="+d,crash_drop_partition_8";
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_8";
+SET SESSION debug="+d,crash_drop_partition_9";
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_9";
+# 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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_5";
+SET SESSION debug="+d,fail_drop_partition_6";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_6";
+SET SESSION debug="+d,fail_drop_partition_7";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_7";
+SET SESSION debug="+d,fail_drop_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_8";
+SET SESSION debug="+d,fail_drop_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_9";
+# 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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10#TMP#.ibd
+t1#P#p10.ibd
+t1#P#p20#TMP#.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10#TMP#.ibd
+t1#P#p10.ibd
+t1#P#p20#TMP#.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10#TMP#.ibd
+t1#P#p10.ibd
+t1#P#p20#TMP#.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10#TMP#.ibd
+t1#P#p10.ibd
+t1#P#p20#TMP#.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+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";
+SET SESSION debug="+d,crash_change_partition_8";
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.ibd
+t1#P#p10#TMP#.ibd
+t1#P#p10.ibd
+t1#P#p20#TMP#.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+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_8";
+SET SESSION debug="+d,crash_change_partition_9";
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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#TMP#.ibd
+t1#P#p10.ibd
+t1#P#p20#TMP#.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+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_9";
+SET SESSION debug="+d,crash_change_partition_10";
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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#TMP#.ibd
+t1#P#p10.ibd
+t1#P#p20#TMP#.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+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_10";
+SET SESSION debug="+d,crash_change_partition_11";
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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#P#p20.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+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_11";
+SET SESSION debug="+d,crash_change_partition_12";
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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#P#p20.ibd
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+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_12";
+# 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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_6";
+SET SESSION debug="+d,fail_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 failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_7";
+SET SESSION debug="+d,fail_change_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_8";
+SET SESSION debug="+d,fail_change_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_9";
+SET SESSION debug="+d,fail_change_partition_10";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_10";
+SET SESSION debug="+d,fail_change_partition_11";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_11";
+SET SESSION debug="+d,fail_change_partition_12";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'InnoDB'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.ibd
+t1#P#p10.ibd
+t1#P#p20.ibd
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = InnoDB,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = InnoDB,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = InnoDB) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_12";

=== added file 'mysql-test/suite/parts/r/partition_debug_myisam.result'
--- a/mysql-test/suite/parts/r/partition_debug_myisam.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/parts/r/partition_debug_myisam.result	2010-08-13 07:50:25 +0000
@@ -0,0 +1,4256 @@
+DROP TABLE IF EXISTS t1;
+# 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");
+# Crash testing ADD PARTITION
+SET SESSION debug="+d,crash_add_partition_1";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_7";
+SET SESSION debug="+d,crash_add_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_8";
+SET SESSION debug="+d,crash_add_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_9";
+SET SESSION debug="+d,crash_add_partition_10";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_add_partition_10";
+# Error recovery testing ADD PARTITION
+SET SESSION debug="+d,fail_add_partition_1";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_7";
+SET SESSION debug="+d,fail_add_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_8";
+SET SESSION debug="+d,fail_add_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_9";
+SET SESSION debug="+d,fail_add_partition_10";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_add_partition_10";
+# Test DROP PARTITION
+SET SESSION debug="+d,crash_drop_partition_1";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_5";
+SET SESSION debug="+d,crash_drop_partition_6";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+#sql-t1.frm
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_6";
+SET SESSION debug="+d,crash_drop_partition_7";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_7";
+SET SESSION debug="+d,crash_drop_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_8";
+SET SESSION debug="+d,crash_drop_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Lost connection to MySQL server during query
+# State after crash (before recovery)
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_drop_partition_9";
+# Error recovery DROP PARTITION
+SET SESSION debug="+d,fail_drop_partition_1";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_5";
+SET SESSION debug="+d,fail_drop_partition_6";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_6";
+SET SESSION debug="+d,fail_drop_partition_7";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_7";
+SET SESSION debug="+d,fail_drop_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_8";
+SET SESSION debug="+d,fail_drop_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 DROP PARTITION p10;
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_drop_partition_9";
+# 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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10#TMP#.MYD
+t1#P#p10#TMP#.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20#TMP#.MYD
+t1#P#p20#TMP#.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10#TMP#.MYD
+t1#P#p10#TMP#.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20#TMP#.MYD
+t1#P#p20#TMP#.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10#TMP#.MYD
+t1#P#p10#TMP#.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20#TMP#.MYD
+t1#P#p20#TMP#.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10#TMP#.MYD
+t1#P#p10#TMP#.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20#TMP#.MYD
+t1#P#p20#TMP#.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_7";
+SET SESSION debug="+d,crash_change_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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
+#sql-t1.par
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10#TMP#.MYD
+t1#P#p10#TMP#.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20#TMP#.MYD
+t1#P#p20#TMP#.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_8";
+SET SESSION debug="+d,crash_change_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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.MYD
+t1#P#p0.MYI
+t1#P#p10#TMP#.MYD
+t1#P#p10#TMP#.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20#TMP#.MYD
+t1#P#p20#TMP#.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_9";
+SET SESSION debug="+d,crash_change_partition_10";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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.MYD
+t1#P#p0.MYI
+t1#P#p10#TMP#.MYD
+t1#P#p10#TMP#.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20#TMP#.MYD
+t1#P#p20#TMP#.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_10";
+SET SESSION debug="+d,crash_change_partition_11";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_11";
+SET SESSION debug="+d,crash_change_partition_12";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before crash
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+# State after crash recovery
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,crash_change_partition_12";
+# 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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+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 = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_6";
+SET SESSION debug="+d,fail_change_partition_7";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_7";
+SET SESSION debug="+d,fail_change_partition_8";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_8";
+SET SESSION debug="+d,fail_change_partition_9";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_9";
+SET SESSION debug="+d,fail_change_partition_10";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_10";
+SET SESSION debug="+d,fail_change_partition_11";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_11";
+SET SESSION debug="+d,fail_change_partition_12";
+CREATE TABLE t1 (a INT, b VARCHAR(64))
+ENGINE = 'MyISAM'
+PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9),
+PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19));
+INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1");
+# State before failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (11,12,13,14,15,16,17,18,19) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+ALTER TABLE t1 REORGANIZE PARTITION p10 INTO
+(PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19),
+PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29));
+ERROR HY000: Unknown error
+# State after failure
+t1#P#p0.MYD
+t1#P#p0.MYI
+t1#P#p10.MYD
+t1#P#p10.MYI
+t1#P#p20.MYD
+t1#P#p20.MYI
+t1.frm
+t1.par
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` varchar(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p0 VALUES IN (0,1,2,3,4,5,6,7,8,9) ENGINE = MyISAM,
+ PARTITION p10 VALUES IN (10,11,12,13,14,15,16,17,18,19) ENGINE = MyISAM,
+ PARTITION p20 VALUES IN (20,21,22,23,24,25,26,27,28,29) ENGINE = MyISAM) */
+SELECT * FROM t1;
+a	b
+1	Original from partition p0
+11	Original from partition p1
+12	Original from partition p1
+13	Original from partition p1
+14	Original from partition p1
+2	Original from partition p0
+3	Original from partition p0
+4	Original from partition p0
+DROP TABLE t1;
+SET SESSION debug="-d,fail_change_partition_12";

=== modified file 'mysql-test/suite/parts/r/partition_special_innodb.result'
--- a/mysql-test/suite/parts/r/partition_special_innodb.result	2010-02-11 11:59:12 +0000
+++ b/mysql-test/suite/parts/r/partition_special_innodb.result	2010-08-13 07:50:25 +0000
@@ -216,3 +216,71 @@ SET SESSION lock_wait_timeout= 1;
 ALTER TABLE t1 AUTO_INCREMENT = 10;
 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
 DROP TABLE t1;
+#
+# Bug#53676: Unexpected errors and possible table corruption on
+#            ADD PARTITION and LOCK TABLE
+CREATE TABLE t1 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
+ENGINE = InnoDB PARTITION BY HASH(i) PARTITIONS 2;
+SET lock_wait_timeout = 2;
+#Connection 1 locks the table
+LOCK TABLE t1 READ;
+# Connection 2 tries to add partitions:
+# First attempt: lock wait timeout (as expected)
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# Second attempt: says that partition already exists
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# Connection 1 unlocks the table and locks it again:
+UNLOCK TABLES;
+LOCK TABLE t1 READ;
+# Connection 2 tries again to add partitions:
+# Third attempt: says that the table does not exist
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# Check table returns the same
+CHECK TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	check	Error	Lock wait timeout exceeded; try restarting transaction
+test.t1	check	error	Corrupt
+UNLOCK TABLES;
+DROP TABLE t1;
+CREATE TABLE t2 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
+ENGINE = InnoDB PARTITION BY HASH(i) PARTITIONS 2;
+SET lock_wait_timeout = 2;
+LOCK TABLE t2 READ;
+ALTER TABLE t2 ADD PARTITION PARTITIONS 2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+ALTER TABLE t2 ADD PARTITION PARTITIONS 2;
+UNLOCK TABLES;
+CHECK TABLE t2;
+Table	Op	Msg_type	Msg_text
+test.t2	check	status	OK
+SELECT * FROM t2;
+i	f
+DROP TABLE t2;
+CREATE TABLE t3 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
+ENGINE = InnoDB PARTITION BY HASH(i) PARTITIONS 2;
+SET lock_wait_timeout = 2;
+# Connection 1 locks the table
+LOCK TABLE t3 READ;
+# Connection 2 tries to add partitions (timeout):
+ALTER TABLE t3 ADD PARTITION PARTITIONS 2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SET lock_wait_timeout = 2;
+# Connection 3 tries to add partitions (partition already exists):
+ALTER TABLE t3 ADD PARTITION PARTITIONS 2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# Connection 4 tries to rename the table:
+RENAME TABLE t3 TO t4;
+# Connection 1 unlocks the table:
+UNLOCK TABLES;
+# Connection 4 gets error on rename:
+# SHOW TABLES returns the table (not renamed):
+SHOW TABLES;
+Tables_in_test
+t4
+# Connection 5 attempts to read from the table (table does not exist):
+SELECT * FROM t3;
+ERROR 42S02: Table 'test.t3' doesn't exist
+DROP TABLE t4;

=== modified file 'mysql-test/suite/parts/r/partition_special_myisam.result'
--- a/mysql-test/suite/parts/r/partition_special_myisam.result	2009-10-20 12:59:42 +0000
+++ b/mysql-test/suite/parts/r/partition_special_myisam.result	2010-08-13 07:50:25 +0000
@@ -200,3 +200,22 @@ a	b	c	d	e	f	g	h	a1	b1	c1	d1	e1	f1	g1	h1	
 1983-12-31	cdef	srtbvsr	w	45634	13452.56	3452346456	127	1983-12-31	cdef	srtbvsr	w	45634	13452.56	3452346456	127	1983-12-31	cdef	srtbvsr	w	45634	13452.56	3452346456	127	1983-12-31	cdef	srtbvsr	w	45634	13452.56	3452346456	127	liuugbzvdmrlti b itiortudirtfgtibm dfi
 1975-01-01	abcde	abcde	m	1234	123.45	32412341234	113	1975-01-01	abcde	abcde	m	1234	123.45	32412341234	113	1975-01-01	abcde	abcde	m	1234	123.45	32412341234	113	1975-01-01	abcde	abcde	m	1234	123.45	32412341234	113	tbhth nrzh ztfghgfh fzh ftzhj fztjh
 drop table t1;
+#
+# Bug#53770: Server crash at handler.cc:2076 on LOAD DATA
+#            after timed out COALESCE PARTITION
+CREATE TABLE t1 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
+ENGINE = MyISAM PARTITION BY HASH(i) PARTITIONS 3;
+# Connection 1 starts transaction and gets lock
+START TRANSACTION;
+SELECT * FROM t1;
+i	f
+SET lock_wait_timeout = 2;
+# Connection 2 tries to coalesce partitions (timeout):
+ALTER TABLE t1 COALESCE PARTITION 2;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+# Connection 3 tries to load into the table:
+LOAD DATA LOCAL INFILE '/tmp/load.in' INTO TABLE t1 (f);
+# Connection 1 commits the transaction
+COMMIT;
+# Connection 3...
+DROP TABLE t1;

=== added file 'mysql-test/suite/parts/t/partition_debug_innodb-master.opt'
--- a/mysql-test/suite/parts/t/partition_debug_innodb-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/parts/t/partition_debug_innodb-master.opt	2010-08-13 07:50:25 +0000
@@ -0,0 +1 @@
+--innodb-file-format-check --innodb-file-per-table=1 --skip-stack-trace --skip-core-file

=== added file 'mysql-test/suite/parts/t/partition_debug_innodb.test'
--- a/mysql-test/suite/parts/t/partition_debug_innodb.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/parts/t/partition_debug_innodb.test	2010-08-13 07:50:25 +0000
@@ -0,0 +1,26 @@
+# Partitioning test that require debug features
+# including crashing tests.
+
+--source include/have_debug.inc
+--source include/have_innodb.inc
+--source include/have_partition.inc
+--source include/not_valgrind.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $DATADIR= `SELECT @@datadir;`
+
+# Checking with #innodb what this is...
+call mtr.add_suppression("InnoDB: Warning: allocated tablespace .*, old maximum was");
+# If there is a crash or failure between the ddl_log is written and the
+# operation is completed, mysql will try to drop a not yet created partition
+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 ");
+
+
+let $engine= 'InnoDB';
+
+--echo # Test crash and failure recovery in fast_alter_partition_table.
+--source suite/parts/inc/partition_mgm_crash.inc

=== added file 'mysql-test/suite/parts/t/partition_debug_myisam-master.opt'
--- a/mysql-test/suite/parts/t/partition_debug_myisam-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/parts/t/partition_debug_myisam-master.opt	2010-08-13 07:50:25 +0000
@@ -0,0 +1 @@
+--skip-stack-trace --skip-core-file

=== added file 'mysql-test/suite/parts/t/partition_debug_myisam.test'
--- a/mysql-test/suite/parts/t/partition_debug_myisam.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/parts/t/partition_debug_myisam.test	2010-08-13 07:50:25 +0000
@@ -0,0 +1,17 @@
+# Partitioning test that require debug features
+# including crashing tests.
+
+--source include/have_debug.inc
+--source include/have_partition.inc
+--source include/not_valgrind.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+--let $DATADIR= `SELECT @@datadir;`
+
+let $engine= 'MyISAM';
+
+--echo # Test crash and failure recovery in fast_alter_partition_table.
+--source suite/parts/inc/partition_mgm_crash.inc

=== modified file 'mysql-test/suite/parts/t/partition_special_innodb-master.opt'
--- a/mysql-test/suite/parts/t/partition_special_innodb-master.opt	2008-08-20 15:29:14 +0000
+++ b/mysql-test/suite/parts/t/partition_special_innodb-master.opt	2010-08-13 07:50:25 +0000
@@ -1 +1 @@
---innodb_lock_wait_timeout=2
+--innodb_lock_wait_timeout=2 --innodb-file-per-table=1

=== modified file 'mysql-test/suite/parts/t/partition_special_innodb.test'
--- a/mysql-test/suite/parts/t/partition_special_innodb.test	2010-02-11 11:59:12 +0000
+++ b/mysql-test/suite/parts/t/partition_special_innodb.test	2010-08-13 07:50:25 +0000
@@ -76,3 +76,132 @@ ALTER TABLE t1 AUTO_INCREMENT = 10;
 --disconnect con1
 --connection default
 DROP TABLE t1;
+
+--echo #
+--echo # Bug#53676: Unexpected errors and possible table corruption on
+--echo #            ADD PARTITION and LOCK TABLE
+--connect (con1,localhost,root,,)
+CREATE TABLE t1 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
+        ENGINE = InnoDB PARTITION BY HASH(i) PARTITIONS 2;
+
+--connect (con2,localhost,root,,)
+SET lock_wait_timeout = 2;
+
+--connection con1
+--echo #Connection 1 locks the table
+LOCK TABLE t1 READ;
+
+--connection con2
+--echo # Connection 2 tries to add partitions:
+--echo # First attempt: lock wait timeout (as expected)
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+--echo # Second attempt: says that partition already exists
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+
+--connection con1
+--echo # Connection 1 unlocks the table and locks it again:
+UNLOCK TABLES;
+--real_sleep 1
+LOCK TABLE t1 READ;
+
+--connection con2
+--echo # Connection 2 tries again to add partitions:
+--echo # Third attempt: says that the table does not exist
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+--echo # Check table returns the same
+CHECK TABLE t1;
+
+--connection con1
+UNLOCK TABLES;
+
+--connection con2
+DROP TABLE t1;
+
+# End of Test1
+
+# Test2
+
+--connection con1
+
+CREATE TABLE t2 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
+        ENGINE = InnoDB PARTITION BY HASH(i) PARTITIONS 2;
+
+--connection con2
+SET lock_wait_timeout = 2;
+
+--connection con1
+LOCK TABLE t2 READ;
+
+--connection con2
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t2 ADD PARTITION PARTITIONS 2;
+send ALTER TABLE t2 ADD PARTITION PARTITIONS 2;
+
+--connection con1
+UNLOCK TABLES;
+
+--connection con2
+--reap
+
+--connect (con3,localhost,root,,)
+CHECK TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2;
+
+# End of Test2
+# Test #3
+
+--connection con1
+
+CREATE TABLE t3 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
+        ENGINE = InnoDB PARTITION BY HASH(i) PARTITIONS 2;
+
+--connection con2
+SET lock_wait_timeout = 2;
+
+--connection con1
+--echo # Connection 1 locks the table
+LOCK TABLE t3 READ;
+
+--connection con2
+--echo # Connection 2 tries to add partitions (timeout):
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t3 ADD PARTITION PARTITIONS 2;
+
+--connection con3
+SET lock_wait_timeout = 2;
+--echo # Connection 3 tries to add partitions (partition already exists):
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t3 ADD PARTITION PARTITIONS 2;
+
+--connect (con4,localhost,root,,)
+--echo # Connection 4 tries to rename the table:
+send RENAME TABLE t3 TO t4;
+
+--connection con1
+--real_sleep 1
+--echo # Connection 1 unlocks the table:
+UNLOCK TABLES;
+
+--connection con4
+--echo # Connection 4 gets error on rename:
+--reap
+
+--connect (con5,localhost,root,,)
+--echo # SHOW TABLES returns the table (not renamed):
+SHOW TABLES;
+--echo # Connection 5 attempts to read from the table (table does not exist):
+--error ER_NO_SUCH_TABLE
+SELECT * FROM t3;
+DROP TABLE t4;
+
+--disconnect con5
+--disconnect con4
+--disconnect con3
+--disconnect con2
+--disconnect con1
+--connection default
+# End of Test #3

=== modified file 'mysql-test/suite/parts/t/partition_special_myisam.test'
--- a/mysql-test/suite/parts/t/partition_special_myisam.test	2007-11-20 15:04:07 +0000
+++ b/mysql-test/suite/parts/t/partition_special_myisam.test	2010-08-13 07:50:25 +0000
@@ -43,3 +43,43 @@ let $engine= 'MyISAM';
 --source suite/parts/inc/partition_key_8col.inc
 --source suite/parts/inc/partition_key_16col.inc
 --source suite/parts/inc/partition_key_32col.inc
+
+--echo #
+--echo # Bug#53770: Server crash at handler.cc:2076 on LOAD DATA
+--echo #            after timed out COALESCE PARTITION
+CREATE TABLE t1 ( i INT NOT NULL AUTO_INCREMENT PRIMARY KEY, f INT )
+        ENGINE = MyISAM PARTITION BY HASH(i) PARTITIONS 3;
+
+--echo # Connection 1 starts transaction and gets lock
+START TRANSACTION;
+SELECT * FROM t1;
+
+--connect (con2,localhost,root,,)
+SET lock_wait_timeout = 2;
+--echo # Connection 2 tries to coalesce partitions (timeout):
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t1 COALESCE PARTITION 2;
+
+--connect (con3,localhost,root,,)
+
+perl;
+open( LD, ">" . "/tmp/load.in" ) || die "Could not open file for writing " . $ENV{'MYSQLTEST_DATADIR'} . "/test/load.in";
+print LD "1\n2\n3\n";
+close( LD );
+EOF
+--echo # Connection 3 tries to load into the table:
+send LOAD DATA LOCAL INFILE '/tmp/load.in' INTO TABLE t1 (f);
+
+--connection default
+--real_sleep 1
+--echo # Connection 1 commits the transaction
+COMMIT;
+
+--connection con3
+--echo # Connection 3...
+--reap
+DROP TABLE t1;
+
+--disconnect con3
+--disconnect con2
+--connection default

=== modified file 'mysql-test/t/partition_innodb.test'
--- a/mysql-test/t/partition_innodb.test	2010-07-06 17:38:03 +0000
+++ b/mysql-test/t/partition_innodb.test	2010-08-13 07:50:25 +0000
@@ -9,6 +9,50 @@ drop table if exists t1, t2;
 let $MYSQLD_DATADIR= `SELECT @@datadir`;
 
 --echo #
+--echo # Bug#50418: DROP PARTITION does not interact with transactions
+--echo #
+CREATE TABLE t1 (
+    id INT AUTO_INCREMENT NOT NULL,
+    name CHAR(50) NOT NULL,
+    myDate DATE NOT NULL,
+    PRIMARY KEY (id, myDate),
+    INDEX idx_date (myDate)
+    ) ENGINE=InnoDB
+PARTITION BY RANGE ( TO_DAYS(myDate) ) (
+    PARTITION p0 VALUES LESS THAN (734028),
+    PARTITION p1 VALUES LESS THAN (734029),
+    PARTITION p2 VALUES LESS THAN (734030),
+    PARTITION p3 VALUES LESS THAN MAXVALUE
+    ) ;
+INSERT INTO t1 VALUES 
+(NULL, 'Lachlan', '2009-09-13'),
+  (NULL, 'Clint', '2009-09-13'),
+  (NULL, 'John', '2009-09-14'),
+  (NULL, 'Dave', '2009-09-14'),
+  (NULL, 'Jeremy', '2009-09-15'),
+  (NULL, 'Scott', '2009-09-15'),
+  (NULL, 'Jeff', '2009-09-16'),
+  (NULL, 'Joe', '2009-09-16');
+SET AUTOCOMMIT=0;
+SELECT * FROM t1 FOR UPDATE;
+UPDATE t1 SET name = 'Mattias' WHERE id = 7;
+SELECT * FROM t1 WHERE id = 7;
+--connect (con1, localhost, root,,)
+--echo # Connection con1
+SET lock_wait_timeout = 1;
+--echo # After the patch it will wait and fail on timeout.
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t1 DROP PARTITION p3;
+SHOW WARNINGS;
+--disconnect con1
+--connection default
+--echo # Connection default
+SELECT * FROM t1;
+--echo # No changes.
+COMMIT;
+DROP TABLE t1;
+
+--echo #
 --echo # Bug#51830: Incorrect partition pruning on range partition (regression)
 --echo #
 CREATE TABLE t1 (a INT NOT NULL)

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2010-07-29 12:32:11 +0000
+++ b/sql/sql_base.cc	2010-08-13 07:50:25 +0000
@@ -8890,87 +8890,6 @@ bool is_equal(const LEX_STRING *a, const
 
 
 /*
-  Unlock and close table before renaming and dropping partitions
-  SYNOPSIS
-    alter_close_tables()
-    lpt                        Struct carrying parameters
-  RETURN VALUES
-    0
-*/
-
-static int alter_close_tables(ALTER_PARTITION_PARAM_TYPE *lpt)
-{
-  TABLE_SHARE *share= lpt->table->s;
-  THD *thd= lpt->thd;
-  TABLE *table;
-  DBUG_ENTER("alter_close_tables");
-  /*
-    We must keep LOCK_open while manipulating with thd->open_tables.
-    Another thread may be working on it.
-  */
-  mysql_mutex_lock(&LOCK_open);
-  /*
-    We can safely remove locks for all tables with the same name:
-    later they will all be closed anyway in
-    alter_partition_lock_handling().
-  */
-  for (table= thd->open_tables; table ; table= table->next)
-  {
-    if (!strcmp(table->s->table_name.str, share->table_name.str) &&
-	!strcmp(table->s->db.str, share->db.str))
-    {
-      mysql_lock_remove(thd, thd->lock, table);
-      table->file->close();
-      table->db_stat= 0;                        // Mark file closed
-      /*
-        Ensure that we won't end up with a crippled table instance
-        in the table cache if an error occurs before we reach
-        alter_partition_lock_handling() and the table is closed
-        by close_thread_tables() instead.
-      */
-      tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED,
-                       table->s->db.str,
-                       table->s->table_name.str);
-    }
-  }
-  mysql_mutex_unlock(&LOCK_open);
-  DBUG_RETURN(0);
-}
-
-
-/*
-  SYNOPSIS
-    abort_and_upgrade_lock_and_close_table()
-    lpt                           Parameter passing struct
-    All parameters passed through the ALTER_PARTITION_PARAM_TYPE object
-  RETURN VALUE
-    0
-  DESCRIPTION
-    Remember old lock level (for possible downgrade later on), abort all
-    waiting threads and ensure that all keeping locks currently are
-    completed such that we own the lock exclusively and no other interaction
-    is ongoing. Close the table and hold the name lock.
-
-    thd                           Thread object
-    table                         Table object
-    db                            Database name
-    table_name                    Table name
-    old_lock_level                Old lock level
-*/
-
-int abort_and_upgrade_lock_and_close_table(ALTER_PARTITION_PARAM_TYPE *lpt)
-{
-  DBUG_ENTER("abort_and_upgrade_lock_and_close_table");
-
-  if (wait_while_table_is_used(lpt->thd, lpt->table, HA_EXTRA_FORCE_REOPEN))
-    DBUG_RETURN(1);
-  if (alter_close_tables(lpt))
-    DBUG_RETURN(1);
-  DBUG_RETURN(0);
-}
-
-
-/*
   Tells if two (or more) tables have auto_increment columns and we want to
   lock those tables with a write lock.
 

=== modified file 'sql/sql_base.h'
--- a/sql/sql_base.h	2010-07-29 10:18:13 +0000
+++ b/sql/sql_base.h	2010-08-13 07:50:25 +0000
@@ -103,15 +103,10 @@ bool reopen_table(TABLE *table);
 bool reopen_tables(THD *thd,bool get_locks,bool in_refresh);
 void close_data_files_and_morph_locks(THD *thd, const char *db,
                                       const char *table_name);
-void close_handle_and_leave_table_as_lock(TABLE *table);
 bool open_new_frm(THD *thd, TABLE_SHARE *share, const char *alias,
                   uint db_stat, uint prgflag,
                   uint ha_open_flags, TABLE *outparam, TABLE_LIST *table_desc,
                   MEM_ROOT *mem_root);
-bool wait_for_tables(THD *thd);
-bool table_is_used(TABLE *table, bool wait_for_name_lock);
-TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name);
-void abort_locked_tables(THD *thd,const char *db, const char *table_name);
 
 bool get_key_map_from_key_list(key_map *map, TABLE *table,
                                List<String> *index_list);
@@ -218,7 +213,6 @@ TABLE *open_n_lock_single_table(THD *thd
                                 thr_lock_type lock_type, uint flags);
 bool open_normal_and_derived_tables(THD *thd, TABLE_LIST *tables, uint flags);
 bool lock_tables(THD *thd, TABLE_LIST *tables, uint counter, uint flags);
-int abort_and_upgrade_lock_and_close_table(ALTER_PARTITION_PARAM_TYPE *lpt);
 int decide_logging_format(THD *thd, TABLE_LIST *tables);
 void free_io_cache(TABLE *entry);
 void intern_close_table(TABLE *entry);
@@ -254,8 +248,6 @@ bool close_cached_tables(THD *thd, TABLE
 bool close_cached_connection_tables(THD *thd, bool wait_for_refresh,
                                     LEX_STRING *connect_string,
                                     bool have_lock = FALSE);
-void close_all_tables_for_name(THD *thd, TABLE_SHARE *share,
-                               bool remove_from_locked_tables);
 OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild);
 bool remove_table_from_cache(THD *thd, const char *db, const char *table,
                              uint flags);

=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc	2010-07-29 12:32:11 +0000
+++ b/sql/sql_partition.cc	2010-08-13 07:50:25 +0000
@@ -71,6 +71,8 @@
 
 #define ERROR_INJECT_CRASH(code) \
   DBUG_EVALUATE_IF(code, (abort(), 0), 0)
+#define ERROR_INJECT_ERROR(code) \
+  DBUG_EVALUATE_IF(code, (my_error(ER_UNKNOWN_ERROR, MYF(0)), TRUE), 0)
 
 /*
   Partition related functions declarations and some static constants;
@@ -6109,25 +6111,32 @@ static bool write_log_add_change_partiti
 {
   partition_info *part_info= lpt->part_info;
   DDL_LOG_MEMORY_ENTRY *log_entry;
-  DDL_LOG_MEMORY_ENTRY *exec_log_entry= NULL;
+  DDL_LOG_MEMORY_ENTRY *exec_log_entry= part_info->exec_log_entry;
   char tmp_path[FN_REFLEN + 1];
   char path[FN_REFLEN + 1];
   uint next_entry= 0;
+  DDL_LOG_MEMORY_ENTRY *old_first_log_entry= part_info->first_log_entry;
+  /* write_log_drop_shadow_frm(lpt) must have been run first */
+  DBUG_ASSERT(old_first_log_entry);
   DBUG_ENTER("write_log_add_change_partition");
 
   build_table_filename(path, sizeof(path) - 1, lpt->db,
                        lpt->table_name, "", 0);
   build_table_shadow_filename(tmp_path, sizeof(tmp_path) - 1, lpt);
   mysql_mutex_lock(&LOCK_gdl);
+
+  /* Relink the previous drop shadow frm entry */
+  if (old_first_log_entry)
+    next_entry= old_first_log_entry->entry_pos;
   if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path,
                                    FALSE))
     goto error;
-  if (write_log_replace_delete_frm(lpt, next_entry, NULL, tmp_path,
-                                  FALSE))
-    goto error;
   log_entry= part_info->first_log_entry;
+
   if (write_execute_ddl_log_entry(log_entry->entry_pos,
-                                    FALSE, &exec_log_entry))
+                                  FALSE,
+                                  /* Reuse the old execute ddl_log_entry */
+                                  &exec_log_entry))
     goto error;
   mysql_mutex_unlock(&LOCK_gdl);
   set_part_info_exec_log_entry(part_info, exec_log_entry);
@@ -6136,7 +6145,7 @@ static bool write_log_add_change_partiti
 error:
   release_part_info_log_entries(part_info->first_log_entry);
   mysql_mutex_unlock(&LOCK_gdl);
-  part_info->first_log_entry= NULL;
+  part_info->first_log_entry= old_first_log_entry;
   my_error(ER_DDL_LOG_ERROR, MYF(0));
   DBUG_RETURN(TRUE);
 }
@@ -6153,9 +6162,15 @@ error:
     TRUE                     Error
     FALSE                    Success
   DESCRIPTION
-    We will write log entries that specify to remove all partitions reorganised,
-    to rename others to reflect the new naming scheme and to install the shadow
-    frm file.
+    We will write log entries that specify to
+    1) Install the shadow frm file.
+    2) Remove all partitions reorganized. (To be able to reorganize a partition
+       to the same name. Like in REORGANIZE p0 INTO (p0, p1),
+       so that the later rename from the new p0-temporary name to p0 don't
+       fail because the partition already exists.
+    3) Rename others to reflect the new naming scheme.
+
+    Note that it is written in the ddl log in reverse.
 */
 
 static bool write_log_final_change_partition(ALTER_PARTITION_PARAM_TYPE *lpt)
@@ -6169,20 +6184,25 @@ static bool write_log_final_change_parti
   uint next_entry= 0;
   DBUG_ENTER("write_log_final_change_partition");
 
+  /*
+    Do not link any previous log entry.
+    Replace the revert operations with forced retry operations.
+  */
   part_info->first_log_entry= NULL;
   build_table_filename(path, sizeof(path) - 1, lpt->db,
                        lpt->table_name, "", 0);
   build_table_shadow_filename(shadow_path, sizeof(shadow_path) - 1, lpt);
   mysql_mutex_lock(&LOCK_gdl);
+  if (write_log_changed_partitions(lpt, &next_entry, (const char*)path))
+    goto error;
   if (write_log_dropped_partitions(lpt, &next_entry, (const char*)path,
                       lpt->alter_info->flags & ALTER_REORGANIZE_PARTITION))
     goto error;
-  if (write_log_changed_partitions(lpt, &next_entry, (const char*)path))
-    goto error;
-  if (write_log_replace_delete_frm(lpt, 0UL, shadow_path, path, TRUE))
+  if (write_log_replace_delete_frm(lpt, next_entry, shadow_path, path, TRUE))
     goto error;
   log_entry= part_info->first_log_entry;
   part_info->frm_log_entry= log_entry;
+  /* Overwrite the revert execute log entry with this retry execute entry */
   if (write_execute_ddl_log_entry(log_entry->entry_pos,
                                     FALSE, &exec_log_entry))
     goto error;
@@ -6282,6 +6302,55 @@ static void alter_partition_lock_handlin
 
 
 /*
+  Unlock and close table before renaming and dropping partitions
+  SYNOPSIS
+    alter_close_tables()
+    lpt                        Struct carrying parameters
+  RETURN VALUES
+    0
+*/
+
+static int alter_close_tables(ALTER_PARTITION_PARAM_TYPE *lpt)
+{
+  TABLE_SHARE *share= lpt->table->s;
+  THD *thd= lpt->thd;
+  TABLE *table;
+  DBUG_ENTER("alter_close_tables");
+  /*
+    We must keep LOCK_open while manipulating with thd->open_tables.
+    Another thread may be working on it.
+  */
+  mysql_mutex_lock(&LOCK_open);
+  /*
+    We can safely remove locks for all tables with the same name:
+    later they will all be closed anyway in
+    alter_partition_lock_handling().
+  */
+  for (table= thd->open_tables; table ; table= table->next)
+  {
+    if (!strcmp(table->s->table_name.str, share->table_name.str) &&
+	!strcmp(table->s->db.str, share->db.str))
+    {
+      mysql_lock_remove(thd, thd->lock, table);
+      table->file->close();
+      table->db_stat= 0;                        // Mark file closed
+      /*
+        Ensure that we won't end up with a crippled table instance
+        in the table cache if an error occurs before we reach
+        alter_partition_lock_handling() and the table is closed
+        by close_thread_tables() instead.
+      */
+      tdc_remove_table(thd, TDC_RT_REMOVE_UNUSED,
+                       table->s->db.str,
+                       table->s->table_name.str);
+    }
+  }
+  mysql_mutex_unlock(&LOCK_open);
+  DBUG_RETURN(0);
+}
+
+
+/*
   Handle errors for ALTER TABLE for partitioning
   SYNOPSIS
     handle_alter_part_error()
@@ -6294,13 +6363,26 @@ static void alter_partition_lock_handlin
 void handle_alter_part_error(ALTER_PARTITION_PARAM_TYPE *lpt,
                              bool not_completed,
                              bool drop_partition,
-                             bool frm_install)
+                             bool frm_install,
+                             bool close_table)
 {
   partition_info *part_info= lpt->part_info;
   DBUG_ENTER("handle_alter_part_error");
 
+  if (close_table)
+  {
+    /*
+      Since the error handling (ddl_log) needs to drop newly created
+      partitions they must be closed first to not issue errors.
+      But we still need some information from the part_info object,
+      so we clone it first to have a copy.
+    */
+    part_info= lpt->part_info->get_clone();
+    alter_close_tables(lpt);
+  }
+
   if (part_info->first_log_entry &&
-      execute_ddl_log_entry(current_thd,
+      execute_ddl_log_entry(lpt->thd,
                             part_info->first_log_entry->entry_pos))
   {
     /*
@@ -6401,6 +6483,22 @@ void handle_alter_part_error(ALTER_PARTI
 }
 
 
+/**
+  Downgrade an exclusive MDL lock if under LOCK TABLE.
+
+  If we don't downgrade the lock, it will not be downgraded or released
+  until the table is unlocked, resulting in blocking other threads using
+  the table.
+*/
+
+static void downgrade_mdl_if_lock_tables_mode(THD *thd, MDL_ticket *ticket,
+                                              enum_mdl_type type)
+{
+  if (thd->locked_tables_mode)
+    ticket->downgrade_exclusive_lock(type);
+}
+
+
 /*
   Actually perform the change requested by ALTER TABLE of partitions
   previously prepared.
@@ -6438,7 +6536,9 @@ uint fast_alter_partition_table(THD *thd
   ALTER_PARTITION_PARAM_TYPE *lpt= &lpt_obj;
   bool written_bin_log= TRUE;
   bool not_completed= TRUE;
+  bool close_table_on_failure= FALSE;
   bool frm_install= FALSE;
+  MDL_ticket *mdl_ticket= table->mdl_ticket;
   DBUG_ENTER("fast_alter_partition_table");
 
   lpt->thd= thd;
@@ -6537,20 +6637,18 @@ uint fast_alter_partition_table(THD *thd
 
       0) Write an entry that removes the shadow frm file if crash occurs 
       1) Write the new frm file as a shadow frm
-      2) Write the ddl log to ensure that the operation is completed
-         even in the presence of a MySQL Server crash
-      3) Lock the table in TL_WRITE_ONLY to ensure all other accesses to
-         the table have completed. This ensures that other threads can not
-         execute on the table in parallel.
-      4) Get an exclusive metadata lock on the table. This ensures that we
+      2) Get an exclusive metadata lock on the table (waits for all active
+         transactions using this table). This ensures that we
          can release all other locks on the table and since no one can open
          the table, there can be no new threads accessing the table. They
          will be hanging on this exclusive lock.
-      5) Close all tables that have already been opened but didn't stumble on
+      3) Write the ddl log to ensure that the operation is completed
+         even in the presence of a MySQL Server crash (the log is executed
+         before any other threads are started, so there are no locking issues).
+      4) Close all tables that have already been opened but didn't stumble on
          the abort locked previously. This is done as part of the
-         close_data_files_and_morph_locks call.
-      6) We are now ready to release all locks we got in this thread.
-      7) Write the bin log
+         alter_close_tables call.
+      5) Write the bin log
          Unfortunately the writing of the binlog is not synchronised with
          other logging activities. So no matter in which order the binlog
          is written compared to other activities there will always be cases
@@ -6561,40 +6659,54 @@ uint fast_alter_partition_table(THD *thd
          require writing the statement first in the ddl log and then
          when recovering from the crash read the binlog and insert it into
          the binlog if not written already.
-      8) Install the previously written shadow frm file
-      9) Prepare handlers for drop of partitions
-      10) Drop the partitions
-      11) Remove entries from ddl log
-      12) Reopen table if under lock tables
-      13) Complete query
+      6) Install the previously written shadow frm file
+      7) Prepare handlers for drop of partitions
+      8) Drop the partitions
+      9) Remove entries from ddl log
+      10) Reopen table if under lock tables
+      11) Complete query
 
       We insert Error injections at all places where it could be interesting
       to test if recovery is properly done.
     */
     if (write_log_drop_shadow_frm(lpt) ||
         ERROR_INJECT_CRASH("crash_drop_partition_1") ||
+        ERROR_INJECT_ERROR("fail_drop_partition_1") ||
         mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
         ERROR_INJECT_CRASH("crash_drop_partition_2") ||
-        write_log_drop_partition(lpt) ||
+        ERROR_INJECT_ERROR("fail_drop_partition_2") ||
+        wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN) ||
         ERROR_INJECT_CRASH("crash_drop_partition_3") ||
-        (not_completed= FALSE) ||
-        abort_and_upgrade_lock_and_close_table(lpt) ||
+        ERROR_INJECT_ERROR("fail_drop_partition_3") ||
+        (close_table_on_failure= TRUE, FALSE) ||
+        write_log_drop_partition(lpt) ||
+        ERROR_INJECT_CRASH("crash_drop_partition_4") ||
+        ERROR_INJECT_ERROR("fail_drop_partition_4") ||
+        (close_table_on_failure= FALSE, FALSE) ||
+        (not_completed= FALSE, FALSE) ||
+        alter_close_tables(lpt) ||
         ERROR_INJECT_CRASH("crash_drop_partition_5") ||
+        ERROR_INJECT_ERROR("fail_drop_partition_5") ||
         ((!thd->lex->no_write_to_binlog) &&
          (write_bin_log(thd, FALSE,
                         thd->query(), thd->query_length()), FALSE)) ||
         ERROR_INJECT_CRASH("crash_drop_partition_6") ||
-        ((frm_install= TRUE), FALSE) ||
+        ERROR_INJECT_ERROR("fail_drop_partition_6") ||
+        (frm_install= TRUE, FALSE) ||
         mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) ||
-        ((frm_install= FALSE), FALSE) ||
+        (frm_install= FALSE, FALSE) ||
         ERROR_INJECT_CRASH("crash_drop_partition_7") ||
+        ERROR_INJECT_ERROR("fail_drop_partition_7") ||
         mysql_drop_partitions(lpt) ||
         ERROR_INJECT_CRASH("crash_drop_partition_8") ||
+        ERROR_INJECT_ERROR("fail_drop_partition_8") ||
         (write_log_completed(lpt, FALSE), FALSE) ||
         ERROR_INJECT_CRASH("crash_drop_partition_9") ||
+        ERROR_INJECT_ERROR("fail_drop_partition_9") ||
         (alter_partition_lock_handling(lpt), FALSE)) 
     {
-      handle_alter_part_error(lpt, not_completed, TRUE, frm_install);
+      handle_alter_part_error(lpt, not_completed, TRUE, frm_install,
+                              close_table_on_failure);
       goto err;
     }
   }
@@ -6613,54 +6725,64 @@ uint fast_alter_partition_table(THD *thd
 
       0) Write an entry that removes the shadow frm file if crash occurs 
       1) Write the new frm file as a shadow frm file
-      2) Log the changes to happen in ddl log
-      2) Add the new partitions
-      3) Lock all partitions in TL_WRITE_ONLY to ensure that no users
-         are still using the old partitioning scheme. Wait until all
-         ongoing users have completed before progressing.
-      4) Get an exclusive metadata lock on the table. This ensures that we
+      2) Get an exclusive metadata lock on the table (waits for all active
+         transactions using this table). This ensures that we
          can release all other locks on the table and since no one can open
          the table, there can be no new threads accessing the table. They
          will be hanging on this exclusive lock.
-      5) Close all tables that have already been opened but didn't stumble on
-         the abort locked previously. This is done as part of the
-         close_data_files_and_morph_locks call.
-      6) Close all table handlers and unlock all handlers but retain
-         metadata lock.
-      7) Write binlog
-      8) Now the change is completed except for the installation of the
+      3) Write an entry to remove the new parttions if crash occurs
+      4) Add the new partitions.
+      5) Close all instances of the table and remove them from the table cache.
+      6) Write binlog
+      7) Now the change is completed except for the installation of the
          new frm file. We thus write an action in the log to change to
          the shadow frm file
-      9) Install the new frm file of the table where the partitions are
+      8) Install the new frm file of the table where the partitions are
          added to the table.
-      10)Wait until all accesses using the old frm file has completed
-      11)Remove entries from ddl log
-      12)Reopen tables if under lock tables
-      13)Complete query
+      9) Remove entries from ddl log
+      10)Reopen tables if under lock tables
+      11)Complete query
     */
-    if (write_log_add_change_partition(lpt) ||
+    if (write_log_drop_shadow_frm(lpt) ||
         ERROR_INJECT_CRASH("crash_add_partition_1") ||
+        ERROR_INJECT_ERROR("fail_add_partition_1") ||
         mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
         ERROR_INJECT_CRASH("crash_add_partition_2") ||
-        mysql_change_partitions(lpt) ||
+        ERROR_INJECT_ERROR("fail_add_partition_2") ||
+        wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN) ||
         ERROR_INJECT_CRASH("crash_add_partition_3") ||
-        abort_and_upgrade_lock_and_close_table(lpt) ||
+        ERROR_INJECT_ERROR("fail_add_partition_3") ||
+        (close_table_on_failure= TRUE, FALSE) ||
+        write_log_add_change_partition(lpt) ||
+        ERROR_INJECT_CRASH("crash_add_partition_4") ||
+        ERROR_INJECT_ERROR("fail_add_partition_4") ||
+        mysql_change_partitions(lpt) ||
         ERROR_INJECT_CRASH("crash_add_partition_5") ||
+        ERROR_INJECT_ERROR("fail_add_partition_5") ||
+        (close_table_on_failure= FALSE, FALSE) ||
+        alter_close_tables(lpt) ||
+        ERROR_INJECT_CRASH("crash_add_partition_6") ||
+        ERROR_INJECT_ERROR("fail_add_partition_6") ||
         ((!thd->lex->no_write_to_binlog) &&
          (write_bin_log(thd, FALSE,
                         thd->query(), thd->query_length()), FALSE)) ||
-        ERROR_INJECT_CRASH("crash_add_partition_6") ||
-        write_log_rename_frm(lpt) ||
-        (not_completed= FALSE) ||
         ERROR_INJECT_CRASH("crash_add_partition_7") ||
-        ((frm_install= TRUE), FALSE) ||
-        mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) ||
+        ERROR_INJECT_ERROR("fail_add_partition_7") ||
+        write_log_rename_frm(lpt) ||
+        (frm_install= TRUE, FALSE) ||
+        (not_completed= FALSE, FALSE) ||
         ERROR_INJECT_CRASH("crash_add_partition_8") ||
-        (write_log_completed(lpt, FALSE), FALSE) ||
+        ERROR_INJECT_ERROR("fail_add_partition_8") ||
+        mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) ||
         ERROR_INJECT_CRASH("crash_add_partition_9") ||
+        ERROR_INJECT_ERROR("fail_add_partition_9") ||
+        (write_log_completed(lpt, FALSE), FALSE) ||
+        ERROR_INJECT_CRASH("crash_add_partition_10") ||
+        ERROR_INJECT_ERROR("fail_add_partition_10") ||
         (alter_partition_lock_handling(lpt), FALSE))
     {
-      handle_alter_part_error(lpt, not_completed, FALSE, frm_install);
+      handle_alter_part_error(lpt, not_completed, FALSE, frm_install,
+                              close_table_on_failure);
       goto err;
     }
   }
@@ -6703,13 +6825,14 @@ uint fast_alter_partition_table(THD *thd
          removed in a crash situation
       3) Add the new partitions
          Copy from the reorganised partitions to the new partitions
-      4) Log that operation is completed and log all complete actions
+      4) Get an exclusive metadata lock on the table (waits for all active
+         transactions using this table). This ensures that we
+         can release all other locks on the table and since no one can open
+         the table, there can be no new threads accessing the table. They
+         will be hanging on this exclusive lock.
+      5) Close all instances of the table and remove them from the table cache.
+      6) Log that operation is completed and log all complete actions
          needed to complete operation from here
-      5) Upgrade shared metadata lock on the table to an exclusive one.
-         After this we can be sure that there is no other connection
-         using this table (they will be waiting for metadata lock).
-      6) Close all table instances opened by this thread, but retain
-         exclusive metadata lock.
       7) Write bin log
       8) Prepare handlers for rename and delete of partitions
       9) Rename and drop the reorged partitions such that they are no
@@ -6718,36 +6841,56 @@ uint fast_alter_partition_table(THD *thd
       11) Reopen the table if under lock tables
       12) Complete query
     */
-    if (write_log_add_change_partition(lpt) ||
+    if (write_log_drop_shadow_frm(lpt) ||
         ERROR_INJECT_CRASH("crash_change_partition_1") ||
+        ERROR_INJECT_ERROR("fail_change_partition_1") ||
         mysql_write_frm(lpt, WFRM_WRITE_SHADOW) ||
         ERROR_INJECT_CRASH("crash_change_partition_2") ||
-        mysql_change_partitions(lpt) ||
+        ERROR_INJECT_ERROR("fail_change_partition_2") ||
+        (close_table_on_failure= TRUE, FALSE) ||
+        write_log_add_change_partition(lpt) ||
         ERROR_INJECT_CRASH("crash_change_partition_3") ||
-        write_log_final_change_partition(lpt) ||
+        ERROR_INJECT_ERROR("fail_change_partition_3") ||
+        mysql_change_partitions(lpt) ||
         ERROR_INJECT_CRASH("crash_change_partition_4") ||
-        (not_completed= FALSE) ||
-        abort_and_upgrade_lock_and_close_table(lpt) ||
+        ERROR_INJECT_ERROR("fail_change_partition_4") ||
+        wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN) ||
+        ERROR_INJECT_CRASH("crash_change_partition_5") ||
+        ERROR_INJECT_ERROR("fail_change_partition_5") ||
+        alter_close_tables(lpt) ||
+        (close_table_on_failure= FALSE) ||
         ERROR_INJECT_CRASH("crash_change_partition_6") ||
+        ERROR_INJECT_ERROR("fail_change_partition_6") ||
+        write_log_final_change_partition(lpt) ||
+        (not_completed= FALSE) ||
+        ERROR_INJECT_CRASH("crash_change_partition_7") ||
+        ERROR_INJECT_ERROR("fail_change_partition_7") ||
         ((!thd->lex->no_write_to_binlog) &&
          (write_bin_log(thd, FALSE,
                         thd->query(), thd->query_length()), FALSE)) ||
-        ERROR_INJECT_CRASH("crash_change_partition_7") ||
-        mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) ||
         ERROR_INJECT_CRASH("crash_change_partition_8") ||
-        mysql_drop_partitions(lpt) ||
+        ERROR_INJECT_ERROR("fail_change_partition_8") ||
+        mysql_write_frm(lpt, WFRM_INSTALL_SHADOW) ||
         ERROR_INJECT_CRASH("crash_change_partition_9") ||
+        ERROR_INJECT_ERROR("fail_change_partition_9") ||
+        mysql_drop_partitions(lpt) ||
+        ERROR_INJECT_CRASH("crash_change_partition_10") ||
+        ERROR_INJECT_ERROR("fail_change_partition_10") ||
         mysql_rename_partitions(lpt) ||
         ((frm_install= TRUE), FALSE) ||
-        ERROR_INJECT_CRASH("crash_change_partition_10") ||
-        (write_log_completed(lpt, FALSE), FALSE) ||
         ERROR_INJECT_CRASH("crash_change_partition_11") ||
+        ERROR_INJECT_ERROR("fail_change_partition_11") ||
+        (write_log_completed(lpt, FALSE), FALSE) ||
+        ERROR_INJECT_CRASH("crash_change_partition_12") ||
+        ERROR_INJECT_ERROR("fail_change_partition_12") ||
         (alter_partition_lock_handling(lpt), FALSE))
     {
-      handle_alter_part_error(lpt, not_completed, FALSE, frm_install);
+      handle_alter_part_error(lpt, not_completed, FALSE, frm_install,
+                              close_table_on_failure);
       goto err;
     }
   }
+  downgrade_mdl_if_lock_tables_mode(thd, mdl_ticket, MDL_SHARED_NO_READ_WRITE);
   /*
     A final step is to write the query to the binlog and send ok to the
     user
@@ -6756,6 +6899,8 @@ uint fast_alter_partition_table(THD *thd
                                  table_list, FALSE, NULL,
                                  written_bin_log));
 err:
+  downgrade_mdl_if_lock_tables_mode(thd, mdl_ticket, MDL_SHARED_NO_READ_WRITE);
+  table->m_needs_reopen= TRUE;
   DBUG_RETURN(TRUE);
 }
 #endif

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2010-07-29 12:32:11 +0000
+++ b/sql/sql_table.cc	2010-08-13 07:50:25 +0000
@@ -1086,6 +1086,7 @@ static bool get_free_ddl_log_entry(DDL_L
   */
   used_entry->next_log_entry= first_used;
   used_entry->prev_log_entry= NULL;
+  used_entry->next_active_log_entry= NULL;
   global_ddl_log.first_used= used_entry;
   if (first_used)
     first_used->prev_log_entry= used_entry;

=== modified file 'sql/table.h'
--- a/sql/table.h	2010-07-29 03:24:35 +0000
+++ b/sql/table.h	2010-08-13 07:50:25 +0000
@@ -43,7 +43,6 @@ class Security_context;
 struct TABLE_LIST;
 class ACL_internal_schema_access;
 class ACL_internal_table_access;
-struct TABLE_LIST;
 class Field;
 
 /*


Attachment: [text/bzr-bundle] bzr/mattias.jonsson@oracle.com-20100813075025-oo0xc7zo479xutz1.bundle
Thread
bzr commit into mysql-5.5-bugfixing branch (mattias.jonsson:3174) Bug#53676Bug#53770Mattias Jonsson13 Aug