Debian Codegraph @

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

raw
1 --source include/have_innodb.inc
2 --source include/have_debug.inc
3 --source include/have_debug_sync.inc
4
5 --enable_connect_log
6
7 #
8 # MDEV-16465 Invalid (old?) table or database name or hang in ha_innobase::delete_table and log semaphore wait upon concurrent DDL with foreign keys
9 #
10 create table t1 (f1 int primary key) engine=innodb;
11 create table t2 (f2 int primary key) engine=innodb;
12 create table t3 (f3 int primary key, foreign key (f3) references t2(f2)) engine=innodb;
13 insert into t1 values (1),(2),(3),(4),(5);
14 insert into t2 values (1),(2),(3),(4),(5);
15 insert into t3 values (1),(2),(3),(4),(5);
16 connect con1,localhost,root;
17 set debug_sync='alter_table_before_rename_result_table signal g1 wait_for g2';
18 send alter table t2 add constraint foreign key (f2) references t1(f1) on delete cascade on update cascade;
19 connection default;
20 let $conn=`select connection_id()`;
21 set debug_sync='before_execute_sql_command wait_for g1';
22 send update t1 set f1 = f1 + 100000 limit 2;
23 connect con2,localhost,root;
24 let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock' and info like 'update t1 %';
25 source include/wait_condition.inc;
26 --replace_result $conn UPDATE
27 eval kill query $conn;
28 disconnect con2;
29 connection default;
30 error ER_QUERY_INTERRUPTED;
31 reap;
32 set debug_sync='now signal g2';
33 connection con1;
34 reap;
35 show create table t2;
36 disconnect con1;
37 connection default;
38 select * from t2 where f2 not in (select f1 from t1);
39 select * from t3 where f3 not in (select f2 from t2);
40 drop table t3;
41 drop table t2;
42 drop table t1;
43 set debug_sync='reset';
44
45 --echo #
46 --echo # MDEV-16060 - InnoDB: Failing assertion: ut_strcmp(index->name, key->name)
47 --echo #
48 CREATE TABLE t1 (`pk` INT PRIMARY KEY) ENGINE=InnoDB;
49 CREATE TABLE t2 LIKE t1;
50 FLUSH TABLES;
51
52 SET debug_sync='alter_table_intermediate_table_created SIGNAL ready WAIT_FOR go';
53 send ALTER TABLE t1 ADD FOREIGN KEY(pk) REFERENCES t2(pk) ON UPDATE CASCADE;
54
55 connect con1, localhost, root;
56 SET debug_sync='now WAIT_FOR ready';
57 SET lock_wait_timeout=0;
58 --error ER_LOCK_WAIT_TIMEOUT
59 UPDATE t2 SET pk=10 WHERE pk=1;
60 PREPARE stmt FROM 'UPDATE t2 SET pk=10 WHERE pk=1';
61 DEALLOCATE PREPARE stmt;
62 SET debug_sync='now SIGNAL go';
63
64 connection default;
65 reap;
66
67 # Cleanup
68 disconnect con1;
69
70 connection default;
71 SET debug_sync='reset';
72 SHOW OPEN TABLES FROM test;
73 DROP TABLE t1, t2;
74
75 #
76 # End of 10.1 tests
77 #