Skip to content

Commit b53d1c9

Browse files
author
Aakanksha Verma
committed
Merge branch 'mysql-5.6' into mysql-5.7
2 parents e74c4aa + be70f59 commit b53d1c9

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

mysql-test/suite/innodb/r/bulk_create_index_online.result

+17
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,20 @@ c1 c2
1818
5 5
1919
6 6
2020
DROP TABLE t1;
21+
CREATE TABLE parent (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB;
22+
INSERT INTO parent VALUES(1,2),(2,2);
23+
CREATE TABLE child (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB;
24+
INSERT INTO child VALUES (10, 2);
25+
SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create
26+
WAIT_FOR go_ahead';
27+
CREATE UNIQUE INDEX idx ON parent(b);;
28+
SET DEBUG_SYNC = 'now WAIT_FOR start_create';
29+
INSERT INTO parent VALUES(4, 2);
30+
SET DEBUG_SYNC = 'now SIGNAL go_ahead';
31+
ERROR 23000: Duplicate entry '2' for key 'idx'
32+
SET DEBUG_SYNC = 'now SIGNAL conn_add_fk';
33+
SET DEBUG_SYNC = 'now WAIT_FOR conn_add_fk';
34+
ALTER TABLE child ADD CONSTRAINT cfx FOREIGN KEY (b) REFERENCES parent(b);
35+
ERROR HY000: Cannot add foreign key constraint
36+
DROP TABLE child;
37+
DROP TABLE parent;

mysql-test/suite/innodb/t/bulk_create_index_online.test

+42
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,45 @@ DROP TABLE t1;
3333
# Clean up temporary files left by crash.
3434
let MYSQLD_DATADIR= `SELECT @@datadir`;
3535
--remove_files_wildcard $MYSQLD_DATADIR/test #sql*.frm
36+
37+
#
38+
## Bug #26654685 INDEX->ID == BTR_PAGE_GET_INDEX_ID(PAGE)
39+
## AT BTR_CUR_SEARCH_TO_NTH_LEVEL IN BTR/B
40+
#
41+
42+
--source include/have_debug.inc
43+
--source include/have_debug_sync.inc
44+
--source include/count_sessions.inc
45+
--source include/have_innodb_max_16k.inc
46+
47+
CREATE TABLE parent (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB;
48+
INSERT INTO parent VALUES(1,2),(2,2);
49+
CREATE TABLE child (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB;
50+
INSERT INTO child VALUES (10, 2);
51+
52+
# This should rollback due to dup key
53+
SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create
54+
WAIT_FOR go_ahead';
55+
--send CREATE UNIQUE INDEX idx ON parent(b);
56+
57+
# Make table ref_count > 1
58+
connect (con1,localhost,root,,);
59+
connection con1;
60+
SET DEBUG_SYNC = 'now WAIT_FOR start_create';
61+
INSERT INTO parent VALUES(4, 2);
62+
SET DEBUG_SYNC = 'now SIGNAL go_ahead';
63+
64+
connection default;
65+
--error ER_DUP_ENTRY
66+
reap;
67+
SET DEBUG_SYNC = 'now SIGNAL conn_add_fk';
68+
69+
connection con1;
70+
SET DEBUG_SYNC = 'now WAIT_FOR conn_add_fk';
71+
--error ER_CANNOT_ADD_FOREIGN
72+
ALTER TABLE child ADD CONSTRAINT cfx FOREIGN KEY (b) REFERENCES parent(b);
73+
74+
--connection default
75+
DROP TABLE child;
76+
DROP TABLE parent;
77+
--disconnect con1

storage/innobase/dict/dict0dict.cc

+5
Original file line numberDiff line numberDiff line change
@@ -3666,6 +3666,11 @@ dict_foreign_find_index(
36663666
&& !(index->type & DICT_FTS)
36673667
&& !dict_index_is_spatial(index)
36683668
&& !index->to_be_dropped
3669+
&& (!(index->uncommitted
3670+
&& ((index->online_status
3671+
== ONLINE_INDEX_ABORTED_DROPPED)
3672+
|| (index->online_status
3673+
== ONLINE_INDEX_ABORTED))))
36693674
&& dict_foreign_qualify_index(
36703675
table, col_names, columns, n_cols,
36713676
index, types_idx,

0 commit comments

Comments
 (0)