summaryrefslogtreecommitdiff
path: root/mysql-test/t/partition_innodb.test
diff options
context:
space:
mode:
authorMattias Jonsson <mattias.jonsson@sun.com>2010-01-18 17:49:18 +0100
committerMattias Jonsson <mattias.jonsson@sun.com>2010-01-18 17:49:18 +0100
commitb1987bdcbfb38b7f42f63d7e70e8f506bcfae0c7 (patch)
tree83e3df645c84493c160956ef4d6a123d0f29e13b /mysql-test/t/partition_innodb.test
parent6d66e660300fd9af03aa7dcdec5c6999cec2ed41 (diff)
downloadmariadb-git-b1987bdcbfb38b7f42f63d7e70e8f506bcfae0c7.tar.gz
Bug#47343: InnoDB fails to clean-up after lock wait timeout on
REORGANIZE PARTITION There were several problems which lead to this this, all related to bad error handling. 1) There was several bugs preventing the ddl-log to be used for cleaning up created files on error. 2) The error handling after the copy partition rows did not close and unlock the tables, resulting in deletion of partitions which were in use, which lead InnoDB to put the partition to drop in a background queue.
Diffstat (limited to 'mysql-test/t/partition_innodb.test')
-rw-r--r--mysql-test/t/partition_innodb.test45
1 files changed, 44 insertions, 1 deletions
diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
index aba28b76f01..b7fe4477a13 100644
--- a/mysql-test/t/partition_innodb.test
+++ b/mysql-test/t/partition_innodb.test
@@ -5,6 +5,8 @@
drop table if exists t1;
--enable_warnings
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+
#
# Bug#47029: Crash when reorganize partition with subpartition
#
@@ -296,6 +298,47 @@ CREATE TABLE t1 (a INT) ENGINE=InnoDB
PARTITION BY list(a) (PARTITION p1 VALUES IN (1));
CREATE INDEX i1 ON t1 (a);
DROP TABLE t1;
-let $MYSQLD_DATADIR= `SELECT @@datadir`;
+
# Before the fix it should show extra file like #sql-2405_2.par
--list_files $MYSQLD_DATADIR/test/ *
+
+--echo #
+--echo # Bug#47343: InnoDB fails to clean-up after lock wait timeout on
+--echo # REORGANIZE PARTITION
+--echo #
+CREATE TABLE t1 (
+ a INT,
+ b DATE NOT NULL,
+ PRIMARY KEY (a, b)
+) ENGINE=InnoDB
+PARTITION BY RANGE (a) (
+ PARTITION pMAX VALUES LESS THAN MAXVALUE
+) ;
+
+INSERT INTO t1 VALUES (1, '2001-01-01'), (2, '2002-02-02'), (3, '2003-03-03');
+
+START TRANSACTION;
+SELECT * FROM t1 FOR UPDATE;
+
+connect (con1, localhost, root,,);
+--echo # Connection con1
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t1 REORGANIZE PARTITION pMAX INTO
+(PARTITION p3 VALUES LESS THAN (3),
+ PARTITION pMAX VALUES LESS THAN MAXVALUE);
+SHOW WARNINGS;
+--error ER_LOCK_WAIT_TIMEOUT
+ALTER TABLE t1 REORGANIZE PARTITION pMAX INTO
+(PARTITION p3 VALUES LESS THAN (3),
+ PARTITION pMAX VALUES LESS THAN MAXVALUE);
+SHOW WARNINGS;
+
+#Contents of the 'test' database directory:
+--list_files $MYSQLD_DATADIR/test
+
+disconnect con1;
+connection default;
+--echo # Connection default
+SELECT * FROM t1;
+COMMIT;
+DROP TABLE t1;