summaryrefslogtreecommitdiff
path: root/mysql-test/suite/innodb/t
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2019-11-01 06:57:20 +0530
committerMarko Mäkelä <marko.makela@mariadb.com>2019-11-01 08:33:59 +0200
commit162f475c4be81dfbceed093ad03d114b4c69a3c0 (patch)
tree60cd5c2d1857a20553e46cbdbb51ef2cc373910c /mysql-test/suite/innodb/t
parent6dce6aecebe6ef78a14cb5c5c5daa8a355551e40 (diff)
downloadmariadb-git-162f475c4be81dfbceed093ad03d114b4c69a3c0.tar.gz
MDEV-20938 Double free of dict_foreign_t during instant ALTER TABLE
innobase_drop_foreign_try(): Don't evict and reload the dict_foreign_t during instant ALTER TABLE if the FOREIGN KEY constraint is being dropped. The MDEV-19630 fix (commit 07b1a26c33b28812a4fd8c814de0fe7d943bbd6b) was incomplete, because it did not cover a case where the FOREIGN KEY constraint is being dropped.
Diffstat (limited to 'mysql-test/suite/innodb/t')
-rw-r--r--mysql-test/suite/innodb/t/instant_alter_bugs.test19
1 files changed, 17 insertions, 2 deletions
diff --git a/mysql-test/suite/innodb/t/instant_alter_bugs.test b/mysql-test/suite/innodb/t/instant_alter_bugs.test
index bab102ebd7f..0edbb672584 100644
--- a/mysql-test/suite/innodb/t/instant_alter_bugs.test
+++ b/mysql-test/suite/innodb/t/instant_alter_bugs.test
@@ -135,8 +135,10 @@ HANDLER h READ `PRIMARY` PREV WHERE 0;
HANDLER h CLOSE;
DROP TABLE t1;
-# MDEV-19630 ALTER TABLE ... ADD COLUMN damages foreign keys which are pointed
-# to the table being altered
+--echo #
+--echo # MDEV-19630 ALTER TABLE ... ADD COLUMN damages foreign keys
+--echo # which are pointed to the table being altered
+--echo #
CREATE TABLE t1(f1 int not null, primary key(f1))engine=innodb;
CREATE TABLE t2(f1 INT AUTO_INCREMENT NOT NULL, f2 INT NOT NULL,
status ENUM ('a', 'b', 'c'), INDEX idx1(f2),
@@ -154,3 +156,16 @@ DROP TABLE t2, t1;
--let $datadir= `select @@datadir`
--remove_file $datadir/test/load.data
+
+--echo #
+--echo # MDEV-20938 Double free of dict_foreign_t during instant ALTER TABLE
+--echo #
+
+CREATE TABLE t1 (id INT UNSIGNED PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT UNSIGNED PRIMARY KEY, b INT UNSIGNED UNIQUE,
+ FOREIGN KEY fk1 (b) REFERENCES t1 (id)) ENGINE=InnoDB;
+ALTER TABLE t2
+ DROP FOREIGN KEY fk1,
+ CHANGE b d INT UNSIGNED,
+ ADD c INT;
+DROP TABLE t2, t1;