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 /storage/innobase | |
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 'storage/innobase')
-rw-r--r-- | storage/innobase/row/row0ins.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index 4e08377916d..f72ade422b3 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -1871,9 +1871,12 @@ do_possible_lock_wait: thr->lock_state = QUE_THR_LOCK_NOLOCK; - if (check_table->to_be_dropped - || trx->error_state == DB_LOCK_WAIT_TIMEOUT) { + err = trx->error_state; + if (err != DB_SUCCESS) { + } else if (check_table->to_be_dropped) { err = DB_LOCK_WAIT_TIMEOUT; + } else { + err = DB_LOCK_WAIT; } my_atomic_addlint(&check_table->n_foreign_key_checks_running, |