| 1 |
--source include/have_debug.inc |
| 2 |
--source include/have_debug_sync.inc |
| 3 |
--source include/have_innodb_max_16k.inc |
| 4 |
|
| 5 |
--enable_connect_log |
| 6 |
|
| 7 |
--echo # |
| 8 |
--echo # Test for bug #26654685 "INDEX->ID == BTR_PAGE_GET_INDEX_ID(PAGE) AT |
| 9 |
--echo # BTR_CUR_SEARCH_TO_NTH_LEVEL IN BTR/B". |
| 10 |
--echo # |
| 11 |
|
| 12 |
CREATE TABLE parent (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB; |
| 13 |
INSERT INTO parent VALUES(1,2),(2,2); |
| 14 |
CREATE TABLE child (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB; |
| 15 |
INSERT INTO child VALUES (10, 2); |
| 16 |
|
| 17 |
|
| 18 |
# This should rollback due to dup key |
| 19 |
SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL start_create WAIT_FOR go_ahead'; |
| 20 |
--send CREATE UNIQUE INDEX idx ON parent(b); |
| 21 |
|
| 22 |
# Make table ref_count > 1 |
| 23 |
connect (con1,localhost,root,,); |
| 24 |
connection con1; |
| 25 |
SET DEBUG_SYNC = 'now WAIT_FOR start_create'; |
| 26 |
INSERT INTO parent VALUES(4, 2); |
| 27 |
SET DEBUG_SYNC = 'now SIGNAL go_ahead'; |
| 28 |
|
| 29 |
connection default; |
| 30 |
--error ER_DUP_ENTRY |
| 31 |
reap; |
| 32 |
SET DEBUG_SYNC = 'now SIGNAL conn_add_fk'; |
| 33 |
|
| 34 |
connection con1; |
| 35 |
SET DEBUG_SYNC = 'now WAIT_FOR conn_add_fk'; |
| 36 |
--error ER_FK_NO_INDEX_PARENT |
| 37 |
ALTER TABLE child ADD CONSTRAINT cfx FOREIGN KEY (b) REFERENCES parent(b); |
| 38 |
|
| 39 |
|
| 40 |
SET DEBUG_SYNC = 'RESET'; |
| 41 |
|
| 42 |
connection default; |
| 43 |
DROP TABLE child; |
| 44 |
DROP TABLE parent; |
| 45 |
|
| 46 |
connection con1; |
| 47 |
disconnect con1; |
| 48 |
--source include/wait_until_disconnected.inc |
| 49 |
connection default; |
| 50 |
|
| 51 |
--echo # |
| 52 |
--echo # Test case for bug#26655360 "ASSERTION FAILURE: DICT0DICT.CC:2045 |
| 53 |
--echo # :TABLE->N_REC_LOCKS == 0". |
| 54 |
|
| 55 |
CREATE TABLE parent (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB; |
| 56 |
CREATE INDEX idx on parent(b); |
| 57 |
INSERT INTO parent VALUES(1,2),(2,2); |
| 58 |
CREATE TABLE child (a INT PRIMARY KEY, b INT NOT NULL) ENGINE = InnoDB; |
| 59 |
INSERT INTO child VALUES (10, 3); |
| 60 |
|
| 61 |
SET DEBUG_SYNC = "innodb_ddl_log_before_enter SIGNAL start_create WAIT_FOR go_ahead"; |
| 62 |
--send ALTER TABLE child ADD CONSTRAINT idx17 FOREIGN KEY (b) REFERENCES parent(a) |
| 63 |
|
| 64 |
--echo # Make table lock _count > 1 |
| 65 |
connect (con1,localhost,root,,); |
| 66 |
connection con1; |
| 67 |
SET DEBUG_SYNC = 'now WAIT_FOR start_create'; |
| 68 |
START TRANSACTION; |
| 69 |
--send DELETE FROM parent WHERE a=1; |
| 70 |
|
| 71 |
connect (con2,localhost,root,,); |
| 72 |
--echo # Wait until DELETE is blocked due to MDL on the parent. |
| 73 |
let $wait_condition= |
| 74 |
SELECT COUNT(*) = 1 FROM information_schema.processlist |
| 75 |
WHERE state = "Waiting for table metadata lock" AND |
| 76 |
info LIKE "DELETE FROM parent %"; |
| 77 |
--source include/wait_condition.inc |
| 78 |
|
| 79 |
SET DEBUG_SYNC = 'now SIGNAL go_ahead'; |
| 80 |
|
| 81 |
disconnect con2; |
| 82 |
--source include/wait_until_disconnected.inc |
| 83 |
|
| 84 |
connection default; |
| 85 |
--replace_regex /#sql.*$/#sql-xxxxx/ |
| 86 |
--error ER_NO_REFERENCED_ROW_2 |
| 87 |
reap; |
| 88 |
|
| 89 |
connection con1; |
| 90 |
reap; |
| 91 |
COMMIT; |
| 92 |
|
| 93 |
disconnect con1; |
| 94 |
--source include/wait_until_disconnected.inc |
| 95 |
connection default; |
| 96 |
|
| 97 |
SET DEBUG_SYNC = 'RESET'; |
| 98 |
DROP TABLE child; |
| 99 |
DROP TABLE parent; |
| 100 |
|
| 101 |
--disable_connect_log |