diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf index 57546c3b2d7..38a57758064 100644 --- a/mysql-test/suite/galera/galera_2nodes.cnf +++ b/mysql-test/suite/galera/galera_2nodes.cnf @@ -16,7 +16,7 @@ wsrep-sync-wait=7 #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep_provider_options='base_port=@mysqld.1.#galera_port' +wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M' wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' wsrep_node_incoming_address=127.0.0.1 @@ -25,7 +25,7 @@ wsrep_node_incoming_address=127.0.0.1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='base_port=@mysqld.2.#galera_port' +wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M' wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' [ENV] diff --git a/mysql-test/suite/innodb/r/innodb-fk.result b/mysql-test/suite/innodb/r/innodb-fk.result index cf883d83874..82ac412e339 100644 --- a/mysql-test/suite/innodb/r/innodb-fk.result +++ b/mysql-test/suite/innodb/r/innodb-fk.result @@ -33,3 +33,37 @@ select * from fk_29; f1 29 drop table t1; +CREATE TABLE t1 ( +id int(11) NOT NULL AUTO_INCREMENT, +f1 int(11) DEFAULT NULL, +PRIMARY KEY (id), +CONSTRAINT fk1 FOREIGN KEY (f1) REFERENCES t1 (id) ON DELETE CASCADE +) ENGINE=InnoDB; +CREATE TABLE t2 ( +id int(11) NOT NULL AUTO_INCREMENT, +f2 int(11) NOT NULL, +f3 int(11) NOT NULL, +PRIMARY KEY (`id`), +CONSTRAINT fk2 FOREIGN KEY (f2) REFERENCES t1 (`id`) ON DELETE CASCADE, +CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE +) ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint +CREATE TABLE t2 ( +id int(11) NOT NULL AUTO_INCREMENT, +f2 int(11) NOT NULL, +f3 int(11) NOT NULL, +PRIMARY KEY (`id`), +CONSTRAINT fk2 FOREIGN KEY (f2) REFERENCES t1 (`id`) ON DELETE CASCADE +) ENGINE=InnoDB; +ALTER TABLE t2 ADD CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE; +ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint +drop table t2; +drop table t1; diff --git a/mysql-test/suite/innodb/t/innodb-fk.test b/mysql-test/suite/innodb/t/innodb-fk.test index 9839cd2d084..2c2a8c76cf8 100644 --- a/mysql-test/suite/innodb/t/innodb-fk.test +++ b/mysql-test/suite/innodb/t/innodb-fk.test @@ -84,3 +84,43 @@ while ($i) drop table t1; +# +# MDEV-7672: Crash creating an InnoDB table with foreign keys +# + +CREATE TABLE t1 ( + id int(11) NOT NULL AUTO_INCREMENT, + f1 int(11) DEFAULT NULL, + PRIMARY KEY (id), + CONSTRAINT fk1 FOREIGN KEY (f1) REFERENCES t1 (id) ON DELETE CASCADE +) ENGINE=InnoDB; + +--error 1005 +CREATE TABLE t2 ( + id int(11) NOT NULL AUTO_INCREMENT, + f2 int(11) NOT NULL, + f3 int(11) NOT NULL, + PRIMARY KEY (`id`), + CONSTRAINT fk2 FOREIGN KEY (f2) REFERENCES t1 (`id`) ON DELETE CASCADE, + CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE +) ENGINE=InnoDB; + +show warnings; + +CREATE TABLE t2 ( + id int(11) NOT NULL AUTO_INCREMENT, + f2 int(11) NOT NULL, + f3 int(11) NOT NULL, + PRIMARY KEY (`id`), + CONSTRAINT fk2 FOREIGN KEY (f2) REFERENCES t1 (`id`) ON DELETE CASCADE +) ENGINE=InnoDB; + +--replace_regex /#sql-[0-9_a-f-]*/#sql-temporary/ +--error 1005 +ALTER TABLE t2 ADD CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE; + +--replace_regex /#sql-[0-9_a-f-]*/#sql-temporary/ +show warnings; + +drop table t2; +drop table t1; diff --git a/mysql-test/suite/wsrep/my.cnf b/mysql-test/suite/wsrep/my.cnf index e6ff7d89751..0b5144b774e 100644 --- a/mysql-test/suite/wsrep/my.cnf +++ b/mysql-test/suite/wsrep/my.cnf @@ -5,5 +5,5 @@ #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port -wsrep_provider_options='base_port=@mysqld.1.#galera_port' +wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M'