diff options
author | Mattias Jonsson <mattias.jonsson@oracle.com> | 2010-11-05 12:01:10 +0100 |
---|---|---|
committer | Mattias Jonsson <mattias.jonsson@oracle.com> | 2010-11-05 12:01:10 +0100 |
commit | c04318ed243fd85eeb7256399516a9189e12a0b0 (patch) | |
tree | 8b7276925b9532dc104baed751d879884fedf169 /mysql-test/t/partition.test | |
parent | 9678beb630abaea8b935bf331fefd3594eb6a66c (diff) | |
download | mariadb-git-c04318ed243fd85eeb7256399516a9189e12a0b0.tar.gz |
Bug#57778: failed primary key add to partitioned innodb table inconsistent and crashes
It was possible to issue an ALTER TABLE ADD PRIMARY KEY on
an partitioned InnoDB table that failed and crashed the server.
The problem was that it succeeded to create the PK on at least
one partition, and then failed on a subsequent partition, due to
duplicate key violation. Since the partitions that already had added
the PK was not reverted all partitions was not consistent with the
table definition, which caused the crash.
The solution was to add a revert step to ha_partition::add_index()
that dropped the index for the already succeeded partitions, on failure.
mysql-test/r/partition.result:
updated result
mysql-test/t/partition.test:
Added test
sql/ha_partition.cc:
Only allow ADD/DROP flags in pairs, so that they can be reverted on failures.
If add_index() fails for a partition, revert (drop the index) for the previous
partitions.
sql/handler.h:
Added some extra info in a comment.
Diffstat (limited to 'mysql-test/t/partition.test')
-rw-r--r-- | mysql-test/t/partition.test | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 68239c06660..cf3dcfadb27 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -15,6 +15,24 @@ drop table if exists t1, t2; --enable_warnings --echo # +--echo # Bug#57778: failed primary key add to partitioned innodb table +--echo # inconsistent and crashes +--echo # +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL) +PARTITION BY KEY (a) PARTITIONS 2; +INSERT INTO t1 VALUES (0,1), (0,2); +--error ER_DUP_ENTRY +ALTER TABLE t1 ADD PRIMARY KEY (a); +SHOW CREATE TABLE t1; +SELECT * FROM t1; +UPDATE t1 SET a = 1, b = 1 WHERE a = 0 AND b = 2; +ALTER TABLE t1 ADD PRIMARY KEY (a); +SELECT * FROM t1; +ALTER TABLE t1 DROP PRIMARY KEY; +SELECT * FROM t1; +DROP TABLE t1; + +--echo # --echo # Bug#57113: ha_partition::extra(ha_extra_function): --echo # Assertion `m_extra_cache' failed CREATE TABLE t1 |