diff options
author | Nisha Gopalakrishnan <nisha.gopalakrishnan@oracle.com> | 2014-06-24 10:15:53 +0530 |
---|---|---|
committer | Nisha Gopalakrishnan <nisha.gopalakrishnan@oracle.com> | 2014-06-24 10:15:53 +0530 |
commit | 0e947e88b166c1b6e6ed82a13770c7e781a2b633 (patch) | |
tree | c5d3e66d0017459f3b4bba37b940fd67ca644888 /mysql-test | |
parent | 7141ae856164c19b6c6faefb4ea7e21a98b0c92a (diff) | |
download | mariadb-git-0e947e88b166c1b6e6ed82a13770c7e781a2b633.tar.gz |
BUG#18618561: FAILED ALTER TABLE ENGINE CHANGE WITH PARTITIONS
CORRUPTS FRM
Analysis:
---------
ALTER TABLE on a partitioned table resulted in the wrong
engine being written into the table's FRM file and displayed
in SHOW CREATE TABLE.
The prep_alter_part_table() modifies the partition_info object
for TABLE instance representing the old version of table.
If the ALTER TABLE ENGINE statement fails, the partition_info
object for the TABLE contains the altered storage engine name.
The SHOW CREATE TABLE uses the TABLE object to display the table
information, hence displays incorrect storage engine for the table.
Also a subsequent successful ALTER TABLE operation will write the
incorrect engine information into the FRM file.
Fix:
---
A copy of the partition_info object is created before modification so
that any changes would not cause the the original partition_info object
to be modified if the ALTER TABLE fails.(Backported part of the code
provided as fix for bug#14156617 in mysql-5.6.6).
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/partition_archive.result | 26 | ||||
-rw-r--r-- | mysql-test/t/partition_archive.test | 18 |
2 files changed, 44 insertions, 0 deletions
diff --git a/mysql-test/r/partition_archive.result b/mysql-test/r/partition_archive.result index 186a7930251..e666c1a8215 100644 --- a/mysql-test/r/partition_archive.result +++ b/mysql-test/r/partition_archive.result @@ -126,3 +126,29 @@ select count(*) from t1; count(*) 100 drop table t1; +# +#BUG 18618561: FAILED ALTER TABLE ENGINE CHANGE WITH PARTITIONS +# CORRUPTS FRM +CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE= MYISAM PARTITION BY HASH(fld1) +PARTITIONS 5; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `fld1` int(11) NOT NULL, + PRIMARY KEY (`fld1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY HASH (fld1) +PARTITIONS 5 */ +ALTER TABLE t1 ENGINE= ARCHIVE; +ERROR HY000: Can't create table 'test.#sql-temporary' (errno: 1) +#After the patch, the ENGINE is correctly displayed as MyISAM +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `fld1` int(11) NOT NULL, + PRIMARY KEY (`fld1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +/*!50100 PARTITION BY HASH (fld1) +PARTITIONS 5 */ +#Cleanup. +DROP TABLE t1; diff --git a/mysql-test/t/partition_archive.test b/mysql-test/t/partition_archive.test index 39551991702..e97f7aca0fd 100644 --- a/mysql-test/t/partition_archive.test +++ b/mysql-test/t/partition_archive.test @@ -126,3 +126,21 @@ show create table t1; select count(*) from t1; drop table t1; + +--echo # +--echo #BUG 18618561: FAILED ALTER TABLE ENGINE CHANGE WITH PARTITIONS +--echo # CORRUPTS FRM + +CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE= MYISAM PARTITION BY HASH(fld1) +PARTITIONS 5; +SHOW CREATE TABLE t1; + +--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t1 ENGINE= ARCHIVE; + +--echo #After the patch, the ENGINE is correctly displayed as MyISAM +SHOW CREATE TABLE t1; + +--echo #Cleanup. +DROP TABLE t1; |