summaryrefslogtreecommitdiff
path: root/mysql-test/t/partition_innodb_plugin.test
diff options
context:
space:
mode:
authorMattias Jonsson <mattias.jonsson@oracle.com>2010-10-05 14:57:51 +0200
committerMattias Jonsson <mattias.jonsson@oracle.com>2010-10-05 14:57:51 +0200
commitdd1d7ff161e22d697eec3c40893d380b0c0ef0bb (patch)
tree03fb3ff555edd8ed2c423b67d536331b522ee627 /mysql-test/t/partition_innodb_plugin.test
parentbd09e49843b83bb96bd64b20ce049f940ca4cc68 (diff)
downloadmariadb-git-dd1d7ff161e22d697eec3c40893d380b0c0ef0bb.tar.gz
Bug#55091: Server crashes on ADD PARTITION after a failed attempt
In case of failure in ALTER ... PARTITION under LOCK TABLE the server could crash, due to it had modified the locked table object, which was not reverted in case of failure, resulting in a bad table definition used after the failed command. Solved by always closing the LOCKED TABLE, even in case of error. Note: this is a 5.1-only fix, bug#56172 fixed it in 5.5+ mysql-test/r/partition_innodb_plugin.result: updated result mysql-test/t/disabled.def: Only disabled valgrind instead. mysql-test/t/partition_innodb_plugin.test: Added test sql/sql_partition.cc: close_thread_tables do not close LOCKED TABLEs and destroys the table object (including part_info), so to avoid it to be reused, always close the table regardless of any previous failure.
Diffstat (limited to 'mysql-test/t/partition_innodb_plugin.test')
-rw-r--r--mysql-test/t/partition_innodb_plugin.test66
1 files changed, 66 insertions, 0 deletions
diff --git a/mysql-test/t/partition_innodb_plugin.test b/mysql-test/t/partition_innodb_plugin.test
index eeb990c0d81..114adf67180 100644
--- a/mysql-test/t/partition_innodb_plugin.test
+++ b/mysql-test/t/partition_innodb_plugin.test
@@ -1,5 +1,71 @@
--source include/have_partition.inc
--source include/have_innodb_plugin.inc
+# Remove the line below when bug#53307 is solved.
+--source include/not_valgrind.inc
+
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+
+call mtr.add_suppression("nnoDB: Error: table `test`.`t1` .* Partition.* InnoDB internal");
+--echo #
+--echo # Bug#55091: Server crashes on ADD PARTITION after a failed attempt
+--echo #
+SET @old_innodb_file_format_check = @@global.innodb_file_format_check;
+SET @old_innodb_file_format = @@global.innodb_file_format;
+SET @old_innodb_file_per_table = @@global.innodb_file_per_table;
+SET @old_innodb_strict_mode = @@global.innodb_strict_mode;
+SET @@global.innodb_file_format = Barracuda,
+@@global.innodb_file_per_table = ON,
+@@global.innodb_strict_mode = ON;
+
+--echo # Connection con1
+--connect(con1,localhost,root,,)
+
+CREATE TABLE t1 (id INT NOT NULL
+PRIMARY KEY,
+user_num CHAR(10)
+) ENGINE = InnoDB
+KEY_BLOCK_SIZE=4
+PARTITION BY HASH(id) PARTITIONS 1;
+
+--list_files $MYSQLD_DATADIR/test
+SHOW CREATE TABLE t1;
+
+SET GLOBAL innodb_file_per_table = OFF;
+
+--disconnect con1
+--connect(con2,localhost,root,,)
+--echo # Connection con2
+
+LOCK TABLE t1 WRITE;
+
+--echo # ALTER fails because COMPRESSED/KEY_BLOCK_SIZE
+--echo # are incompatible with innodb_file_per_table = OFF;
+
+--error ER_GET_ERRNO
+ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
+
+--list_files $MYSQLD_DATADIR/test
+--echo # This SET is not needed to reproduce the bug,
+--echo # it is here just to make the test case more realistic
+SET innodb_strict_mode = OFF;
+
+ALTER TABLE t1 ADD PARTITION PARTITIONS 2;
+--list_files $MYSQLD_DATADIR/test
+
+# really bug#56172
+ALTER TABLE t1 REBUILD PARTITION p0;
+
+UNLOCK TABLES;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--disconnect con2
+--connection default
+--echo # Connection default
+SET @@global.innodb_strict_mode = @old_innodb_strict_mode;
+SET @@global.innodb_file_format = @old_innodb_file_format;
+SET @@global.innodb_file_per_table = @old_innodb_file_per_table;
+SET @@global.innodb_file_format_check = @old_innodb_file_format_check;
#
# Bug#32430 - show engine innodb status causes errors