diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-10-25 09:08:44 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-10-25 10:35:46 +0300 |
commit | a21e01a53d309c4c949d41f85a43211008bac1fc (patch) | |
tree | 5e2f85f9a6e7763eeb45f6ffc1b877f4521af51a /mysql-test/suite/innodb/r/foreign_key.result | |
parent | ab1ce2204e959bea596817494e932754ab5cbe88 (diff) | |
download | mariadb-git-a21e01a53d309c4c949d41f85a43211008bac1fc.tar.gz |
MDEV-17541 KILL QUERY during lock wait in FOREIGN KEY check causes hang
row_ins_check_foreign_constraint(): Do not overwrite hard errors
with the soft error DB_LOCK_WAIT. This prevents an infinite
wait loop when DB_INTERRUPTED was returned. For DB_LOCK_WAIT,
row_insert_for_mysql() would keep invoking row_ins_step() and the
transaction would remain active until the server shutdown is initiated.
Diffstat (limited to 'mysql-test/suite/innodb/r/foreign_key.result')
-rw-r--r-- | mysql-test/suite/innodb/r/foreign_key.result | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/mysql-test/suite/innodb/r/foreign_key.result b/mysql-test/suite/innodb/r/foreign_key.result index a151651b594..831417aff5c 100644 --- a/mysql-test/suite/innodb/r/foreign_key.result +++ b/mysql-test/suite/innodb/r/foreign_key.result @@ -252,7 +252,6 @@ DELETE FROM t1 WHERE id = 1; ERROR HY000: Lock wait timeout exceeded; try restarting transaction connection con1; COMMIT; -disconnect con1; connection default; SELECT * FROM t2; id ref_id f @@ -332,7 +331,25 @@ PRIMARY KEY (store_id), UNIQUE KEY idx_unique_manager (manager_staff_id), CONSTRAINT fk_store_staff FOREIGN KEY (manager_staff_id) REFERENCES staff (staff_id) ON DELETE RESTRICT ON UPDATE CASCADE ) ENGINE=InnoDB; -SET FOREIGN_KEY_CHECKS=DEFAULT; LOCK TABLE staff WRITE; UNLOCK TABLES; DROP TABLES staff, store; +SET FOREIGN_KEY_CHECKS=1; +# +# MDEV-17541 KILL QUERY during lock wait in FOREIGN KEY check hangs +# +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 (a INT PRIMARY KEY, FOREIGN KEY (a) REFERENCES t1(a)) +ENGINE=InnoDB; +connection con1; +INSERT INTO t1 SET a=1; +BEGIN; +DELETE FROM t1; +connection default; +INSERT INTO t2 SET a=1; +connection con1; +kill query @id; +connection default; +ERROR 70100: Query execution was interrupted +disconnect con1; +DROP TABLE t2,t1; |