diff options
author | Sergei Golubchik <serg@mariadb.org> | 2018-07-18 19:04:51 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-09-04 09:49:52 +0200 |
commit | dd74332d2c5953e861780c1d0de61673406c9653 (patch) | |
tree | eb0b24f15d7730a0432190622ff027034c201da1 /mysql-test/suite/innodb/r | |
parent | 710093ccb032fa9247e87e6174c91abc40bc567f (diff) | |
download | mariadb-git-dd74332d2c5953e861780c1d0de61673406c9653.tar.gz |
MDEV-12669 Circular foreign keys cause a loop and OOM upon LOCK TABLE
table_already_fk_prelocked() was looking for a table in the wrong
list (not the complete list of prelocked tables, but only in its tail,
starting from the current table - which is always empty for the last
added table), so for circular FKs it kept adding same tables to the list
indefinitely.
Backport of d6d7e169fbf
Diffstat (limited to 'mysql-test/suite/innodb/r')
-rw-r--r-- | mysql-test/suite/innodb/r/foreign_key.result | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/foreign_key.result b/mysql-test/suite/innodb/r/foreign_key.result new file mode 100644 index 00000000000..0d04f27f51f --- /dev/null +++ b/mysql-test/suite/innodb/r/foreign_key.result @@ -0,0 +1,19 @@ +SET FOREIGN_KEY_CHECKS=0; +CREATE TABLE staff ( +staff_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT, +store_id TINYINT UNSIGNED NOT NULL, +PRIMARY KEY (staff_id), +KEY idx_fk_store_id (store_id), +CONSTRAINT fk_staff_store FOREIGN KEY (store_id) REFERENCES store (store_id) ON DELETE RESTRICT ON UPDATE CASCADE +) ENGINE=InnoDB; +CREATE TABLE store ( +store_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT, +manager_staff_id TINYINT UNSIGNED NOT NULL, +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; |