diff options
author | Nirbhay Choubey <nirbhay@mariadb.com> | 2014-09-30 18:06:15 -0400 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2014-09-30 18:06:15 -0400 |
commit | 9a57de86beda0032a6dd9f804822e2651eb869bf (patch) | |
tree | 7c1b645c0f4e4392c3c47da46f4c5d08b0c28a86 /mysql-test/suite/galera/t/galera_fk_conflict.test | |
parent | c916085e271cd049537b1e07b36cd060c44750bd (diff) | |
download | mariadb-git-9a57de86beda0032a6dd9f804822e2651eb869bf.tar.gz |
bzr merge -r4123..4144 codership/5.6
Diffstat (limited to 'mysql-test/suite/galera/t/galera_fk_conflict.test')
-rw-r--r-- | mysql-test/suite/galera/t/galera_fk_conflict.test | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/mysql-test/suite/galera/t/galera_fk_conflict.test b/mysql-test/suite/galera/t/galera_fk_conflict.test new file mode 100644 index 00000000000..cb6f95ee687 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_fk_conflict.test @@ -0,0 +1,41 @@ +# +# Test two transactions on separate nodes which conflict on a FK +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE parent ( + id INT PRIMARY KEY, + KEY (id) +) ENGINE=InnoDB; + +CREATE TABLE child ( + id INT PRIMARY KEY, + parent_id INT, + FOREIGN KEY (parent_id) + REFERENCES parent(id) +) ENGINE=InnoDB; + +INSERT INTO parent VALUES (1), (2); +INSERT INTO child VALUES (1,1); + +--connection node_1 +SET AUTOCOMMIT = OFF; +START TRANSACTION; +DELETE FROM parent WHERE id = 2; + +--connection node_2 +SET AUTOCOMMIT = OFF; +START TRANSACTION; +INSERT INTO child VALUES (2, 2); + +--connection node_1 +COMMIT; + +--connection node_2 +--error ER_LOCK_DEADLOCK +COMMIT; + +DROP TABLE child; +DROP TABLE parent; |