| 1 |
connection node_2; |
| 2 |
connection node_1; |
| 3 |
# |
| 4 |
# test phase with foreign key of varchar type |
| 5 |
# |
| 6 |
connection node_1; |
| 7 |
CREATE TABLE parent ( |
| 8 |
`id` varchar(36) COLLATE utf8_unicode_ci NOT NULL, |
| 9 |
PRIMARY KEY (`id`) |
| 10 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |
| 11 |
CREATE TABLE child ( |
| 12 |
`id` int NOT NULL, |
| 13 |
`parent_id` varchar(36) COLLATE utf8_unicode_ci DEFAULT NULL, |
| 14 |
PRIMARY KEY (`id`), |
| 15 |
KEY `parent_id` (`parent_id`), |
| 16 |
CONSTRAINT `ipallocations_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`) ON DELETE CASCADE |
| 17 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; |
| 18 |
INSERT INTO parent VALUES ('row one'), ('row two'); |
| 19 |
INSERT INTO child VALUES (1,'row one'), (2,'row two'); |
| 20 |
connection node_2; |
| 21 |
DELETE FROM parent; |
| 22 |
connection node_1; |
| 23 |
SELECT * FROM parent; |
| 24 |
id |
| 25 |
SELECT * FROM child; |
| 26 |
id parent_id |
| 27 |
DROP TABLE child; |
| 28 |
DROP TABLE parent; |
| 29 |
# |
| 30 |
# test phase with MM conflict in FK cascade |
| 31 |
# |
| 32 |
connection node_1; |
| 33 |
set wsrep_retry_autocommit=0; |
| 34 |
CREATE TABLE parent ( |
| 35 |
id INT NOT NULL PRIMARY KEY |
| 36 |
) ENGINE=InnoDB; |
| 37 |
CREATE TABLE child ( |
| 38 |
id INT NOT NULL PRIMARY KEY, |
| 39 |
j int default 0, |
| 40 |
parent_id INT, |
| 41 |
FOREIGN KEY (parent_id) |
| 42 |
REFERENCES parent(id) |
| 43 |
ON DELETE CASCADE |
| 44 |
) ENGINE=InnoDB; |
| 45 |
INSERT INTO parent VALUES (1); |
| 46 |
INSERT INTO child VALUES (1,0,1); |
| 47 |
connection node_2; |
| 48 |
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; |
| 49 |
SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; |
| 50 |
connection node_2; |
| 51 |
DELETE FROM parent; |
| 52 |
connection node_1a; |
| 53 |
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; |
| 54 |
connection node_1; |
| 55 |
update child set j=2;; |
| 56 |
connection node_1a; |
| 57 |
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; |
| 58 |
SET GLOBAL debug_dbug = ""; |
| 59 |
SET DEBUG_SYNC = "RESET"; |
| 60 |
connection node_1; |
| 61 |
SELECT * FROM parent; |
| 62 |
id |
| 63 |
SELECT * FROM child; |
| 64 |
id j parent_id |
| 65 |
DROP TABLE child; |
| 66 |
DROP TABLE parent; |