Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-15219

FOREIGN KEY CASCADE or SET NULL operations will not resume after lock wait

    Details

      Description

      If a lock wait occurs during the processing of a FOREIGN KEY constraint, InnoDB will fail to resume the FOREIGN KEY operation once the conflicting lock has been released.

      The problem was introduced in MDEV-13331, in the function row_ins_check_foreign_constraint():

      		err = check_table->to_be_dropped
      			? DB_LOCK_WAIT_TIMEOUT
      			: trx->error_state;
      

      We should not assign other values than DB_LOCK_WAIT_TIMEOUT to err here. The following code works both for innodb.foreign_keys and the MySQL 5.7 test innodb.update-cascade which had been missing from MariaDB:

      		if (check_table->to_be_dropped
      		    || trx->error_state == DB_LOCK_WAIT_TIMEOUT) {
      			err = DB_LOCK_WAIT_TIMEOUT;
      		}
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                marko Marko Mäkelä
                Reporter:
                marko Marko Mäkelä
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: