Skip to content

Commit d8eef0f

Browse files
committed
Merge 10.1 into 10.2
2 parents 899c589 + 29b6e80 commit d8eef0f

File tree

4 files changed

+46
-4
lines changed

4 files changed

+46
-4
lines changed

mysql-test/suite/innodb/r/innodb-index-online.result

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,6 @@ ddl_online_create_index 0
470470
ddl_pending_alter_table 0
471471
ddl_sort_file_alter_table 0
472472
ddl_log_file_alter_table 2
473-
connection con1;
474-
disconnect con1;
475473
connection default;
476474
SHOW CREATE TABLE t1;
477475
Table Create Table
@@ -498,6 +496,25 @@ ERROR 42000: Duplicate key name 'c2h'
498496
SET DEBUG_SYNC = 'RESET';
499497
SET GLOBAL innodb_monitor_disable = module_ddl;
500498
DROP TABLE t1;
499+
#
500+
# MDEV-13205 assertion !dict_index_is_online_ddl(index) upon ALTER TABLE
501+
#
502+
CREATE TABLE t1 (c VARCHAR(64)) ENGINE=InnoDB;
503+
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL t1u_created WAIT_FOR dup_done';
504+
ALTER TABLE t1 ADD UNIQUE(c);
505+
connection con1;
506+
SET DEBUG_SYNC = 'now WAIT_FOR t1u_created';
507+
BEGIN;
508+
INSERT INTO t1 VALUES('bar'),('bar');
509+
SET DEBUG_SYNC = 'now SIGNAL dup_done';
510+
connection default;
511+
ERROR 23000: Duplicate entry 'bar' for key 'c'
512+
SET DEBUG_SYNC = 'RESET';
513+
disconnect con1;
514+
CREATE TABLE t2 (c VARCHAR(64)) ENGINE=InnoDB;
515+
ALTER TABLE t2 ADD FOREIGN KEY (c) REFERENCES t1 (c);
516+
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
517+
DROP TABLE t2,t1;
501518
SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig;
502519
SET GLOBAL innodb_monitor_enable = default;
503520
SET GLOBAL innodb_monitor_disable = default;

mysql-test/suite/innodb/t/innodb-index-online.test

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,6 @@ connection default;
457457
reap;
458458
--enable_parsing
459459
#remove below con1 disconnect if above test case is enabled
460-
connection con1;
461-
disconnect con1;
462460
connection default;
463461

464462
SHOW CREATE TABLE t1;
@@ -474,6 +472,31 @@ SET GLOBAL innodb_monitor_disable = module_ddl;
474472

475473
DROP TABLE t1;
476474

475+
--echo #
476+
--echo # MDEV-13205 assertion !dict_index_is_online_ddl(index) upon ALTER TABLE
477+
--echo #
478+
CREATE TABLE t1 (c VARCHAR(64)) ENGINE=InnoDB;
479+
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL t1u_created WAIT_FOR dup_done';
480+
send ALTER TABLE t1 ADD UNIQUE(c);
481+
482+
connection con1;
483+
SET DEBUG_SYNC = 'now WAIT_FOR t1u_created';
484+
BEGIN;
485+
INSERT INTO t1 VALUES('bar'),('bar');
486+
SET DEBUG_SYNC = 'now SIGNAL dup_done';
487+
488+
connection default;
489+
--error ER_DUP_ENTRY
490+
reap;
491+
492+
SET DEBUG_SYNC = 'RESET';
493+
disconnect con1;
494+
CREATE TABLE t2 (c VARCHAR(64)) ENGINE=InnoDB;
495+
--replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
496+
--error ER_CANT_CREATE_TABLE
497+
ALTER TABLE t2 ADD FOREIGN KEY (c) REFERENCES t1 (c);
498+
DROP TABLE t2,t1;
499+
477500
# Check that all connections opened by test cases in this file are really
478501
# gone so execution of other tests won't be affected by their presence.
479502
--source include/wait_until_count_sessions.inc

storage/innobase/dict/dict0dict.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3439,6 +3439,7 @@ dict_foreign_find_index(
34393439
&& !(index->type & DICT_FTS)
34403440
&& !dict_index_is_spatial(index)
34413441
&& !index->to_be_dropped
3442+
&& !dict_index_is_online_ddl(index)
34423443
&& dict_foreign_qualify_index(
34433444
table, col_names, columns, n_cols,
34443445
index, types_idx,

storage/xtradb/dict/dict0dict.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3409,6 +3409,7 @@ dict_foreign_find_index(
34093409
if (types_idx != index
34103410
&& !(index->type & DICT_FTS)
34113411
&& !index->to_be_dropped
3412+
&& !dict_index_is_online_ddl(index)
34123413
&& dict_foreign_qualify_index(
34133414
table, col_names, columns, n_cols,
34143415
index, types_idx,

0 commit comments

Comments
 (0)