summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-01-08 16:45:58 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-01-08 16:49:31 +0200
commitd8eef0f6116c38a216492239c895412b2d537c28 (patch)
tree5fed97754ca9bb6ac4a3597083298e8528fbbd88
parent899c5899becbaf18651215693fb455001476b577 (diff)
parent29b6e809a9900c0942687a2eefe71cd706242f9e (diff)
downloadmariadb-git-d8eef0f6116c38a216492239c895412b2d537c28.tar.gz
Merge 10.1 into 10.2
-rw-r--r--mysql-test/suite/innodb/r/innodb-index-online.result21
-rw-r--r--mysql-test/suite/innodb/t/innodb-index-online.test27
-rw-r--r--storage/innobase/dict/dict0dict.cc1
-rw-r--r--storage/xtradb/dict/dict0dict.cc1
4 files changed, 46 insertions, 4 deletions
diff --git a/mysql-test/suite/innodb/r/innodb-index-online.result b/mysql-test/suite/innodb/r/innodb-index-online.result
index 5427f13043d..3134c64c8c6 100644
--- a/mysql-test/suite/innodb/r/innodb-index-online.result
+++ b/mysql-test/suite/innodb/r/innodb-index-online.result
@@ -470,8 +470,6 @@ ddl_online_create_index 0
ddl_pending_alter_table 0
ddl_sort_file_alter_table 0
ddl_log_file_alter_table 2
-connection con1;
-disconnect con1;
connection default;
SHOW CREATE TABLE t1;
Table Create Table
@@ -498,6 +496,25 @@ ERROR 42000: Duplicate key name 'c2h'
SET DEBUG_SYNC = 'RESET';
SET GLOBAL innodb_monitor_disable = module_ddl;
DROP TABLE t1;
+#
+# MDEV-13205 assertion !dict_index_is_online_ddl(index) upon ALTER TABLE
+#
+CREATE TABLE t1 (c VARCHAR(64)) ENGINE=InnoDB;
+SET DEBUG_SYNC = 'row_log_apply_before SIGNAL t1u_created WAIT_FOR dup_done';
+ALTER TABLE t1 ADD UNIQUE(c);
+connection con1;
+SET DEBUG_SYNC = 'now WAIT_FOR t1u_created';
+BEGIN;
+INSERT INTO t1 VALUES('bar'),('bar');
+SET DEBUG_SYNC = 'now SIGNAL dup_done';
+connection default;
+ERROR 23000: Duplicate entry 'bar' for key 'c'
+SET DEBUG_SYNC = 'RESET';
+disconnect con1;
+CREATE TABLE t2 (c VARCHAR(64)) ENGINE=InnoDB;
+ALTER TABLE t2 ADD FOREIGN KEY (c) REFERENCES t1 (c);
+ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+DROP TABLE t2,t1;
SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig;
SET GLOBAL innodb_monitor_enable = default;
SET GLOBAL innodb_monitor_disable = default;
diff --git a/mysql-test/suite/innodb/t/innodb-index-online.test b/mysql-test/suite/innodb/t/innodb-index-online.test
index 5509d985edc..efe1c796cf1 100644
--- a/mysql-test/suite/innodb/t/innodb-index-online.test
+++ b/mysql-test/suite/innodb/t/innodb-index-online.test
@@ -457,8 +457,6 @@ connection default;
reap;
--enable_parsing
#remove below con1 disconnect if above test case is enabled
-connection con1;
-disconnect con1;
connection default;
SHOW CREATE TABLE t1;
@@ -474,6 +472,31 @@ SET GLOBAL innodb_monitor_disable = module_ddl;
DROP TABLE t1;
+--echo #
+--echo # MDEV-13205 assertion !dict_index_is_online_ddl(index) upon ALTER TABLE
+--echo #
+CREATE TABLE t1 (c VARCHAR(64)) ENGINE=InnoDB;
+SET DEBUG_SYNC = 'row_log_apply_before SIGNAL t1u_created WAIT_FOR dup_done';
+send ALTER TABLE t1 ADD UNIQUE(c);
+
+connection con1;
+SET DEBUG_SYNC = 'now WAIT_FOR t1u_created';
+BEGIN;
+INSERT INTO t1 VALUES('bar'),('bar');
+SET DEBUG_SYNC = 'now SIGNAL dup_done';
+
+connection default;
+--error ER_DUP_ENTRY
+reap;
+
+SET DEBUG_SYNC = 'RESET';
+disconnect con1;
+CREATE TABLE t2 (c VARCHAR(64)) ENGINE=InnoDB;
+--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
+--error ER_CANT_CREATE_TABLE
+ALTER TABLE t2 ADD FOREIGN KEY (c) REFERENCES t1 (c);
+DROP TABLE t2,t1;
+
# Check that all connections opened by test cases in this file are really
# gone so execution of other tests won't be affected by their presence.
--source include/wait_until_count_sessions.inc
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index e368fafad2a..49c60e5df56 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -3439,6 +3439,7 @@ dict_foreign_find_index(
&& !(index->type & DICT_FTS)
&& !dict_index_is_spatial(index)
&& !index->to_be_dropped
+ && !dict_index_is_online_ddl(index)
&& dict_foreign_qualify_index(
table, col_names, columns, n_cols,
index, types_idx,
diff --git a/storage/xtradb/dict/dict0dict.cc b/storage/xtradb/dict/dict0dict.cc
index 5af3a635a96..9257321c7ef 100644
--- a/storage/xtradb/dict/dict0dict.cc
+++ b/storage/xtradb/dict/dict0dict.cc
@@ -3409,6 +3409,7 @@ dict_foreign_find_index(
if (types_idx != index
&& !(index->type & DICT_FTS)
&& !index->to_be_dropped
+ && !dict_index_is_online_ddl(index)
&& dict_foreign_qualify_index(
table, col_names, columns, n_cols,
index, types_idx,