Commit cf6114eb authored by Jan Lindström's avatar Jan Lindström

MDEV-24432 : galera.galera_fk_cascade_delete_debug MTR failed: query 'reap'...

MDEV-24432 : galera.galera_fk_cascade_delete_debug MTR failed: query 'reap' failed: 1205: Lock wait timeout exceeded

Add wait_conditions to verify correct database state before
next operation.
parent 9e3aa83f
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# test phase with cascading foreign key through 3 tables # test phase with cascading foreign key through 3 tables
# #
connection node_1; connection node_1;
set wsrep_sync_wait=0;
CREATE TABLE grandparent ( CREATE TABLE grandparent (
id INT NOT NULL PRIMARY KEY id INT NOT NULL PRIMARY KEY
) ENGINE=InnoDB; ) ENGINE=InnoDB;
...@@ -24,15 +23,26 @@ INSERT INTO grandparent VALUES (1),(2); ...@@ -24,15 +23,26 @@ INSERT INTO grandparent VALUES (1),(2);
INSERT INTO parent VALUES (1,1), (2,2); INSERT INTO parent VALUES (1,1), (2,2);
INSERT INTO child VALUES (1,1), (2,2); INSERT INTO child VALUES (1,1), (2,2);
connection node_2; connection node_2;
set wsrep_sync_wait=0;
DELETE FROM grandparent WHERE id = 1; DELETE FROM grandparent WHERE id = 1;
SELECT * FROM grandparent;
id
2
SELECT * FROM parent;
id grandparent_id
2 2
SELECT * FROM child;
id parent_id
2 2
connection node_1; connection node_1;
SELECT COUNT(*), COUNT(*) = 0 FROM parent WHERE grandparent_id = 1; SELECT * FROM grandparent;
COUNT(*) COUNT(*) = 0 id
0 1 2
SELECT COUNT(*), COUNT(*) = 0 FROM child WHERE parent_id = 1; SELECT * FROM parent;
COUNT(*) COUNT(*) = 0 id grandparent_id
0 1 2 2
SELECT * FROM child;
id parent_id
2 2
DROP TABLE child; DROP TABLE child;
DROP TABLE parent; DROP TABLE parent;
DROP TABLE grandparent; DROP TABLE grandparent;
...@@ -18,12 +18,10 @@ INSERT INTO child VALUES (1,'row one'), (2,'row two'); ...@@ -18,12 +18,10 @@ INSERT INTO child VALUES (1,'row one'), (2,'row two');
connection node_2; connection node_2;
DELETE FROM parent; DELETE FROM parent;
connection node_1; connection node_1;
SELECT COUNT(*), COUNT(*) = 0 FROM parent; SELECT * FROM parent;
COUNT(*) COUNT(*) = 0 id
0 1 SELECT * FROM child;
SELECT COUNT(*), COUNT(*) = 0 FROM child; id parent_id
COUNT(*) COUNT(*) = 0
0 1
DROP TABLE child; DROP TABLE child;
DROP TABLE parent; DROP TABLE parent;
# #
...@@ -44,6 +42,7 @@ ON DELETE CASCADE ...@@ -44,6 +42,7 @@ ON DELETE CASCADE
) ENGINE=InnoDB; ) ENGINE=InnoDB;
INSERT INTO parent VALUES (1); INSERT INTO parent VALUES (1);
INSERT INTO child VALUES (1,0,1); INSERT INTO child VALUES (1,0,1);
connection node_2;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
connection node_2; connection node_2;
...@@ -57,11 +56,9 @@ SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; ...@@ -57,11 +56,9 @@ SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
SET GLOBAL debug_dbug = ""; SET GLOBAL debug_dbug = "";
SET DEBUG_SYNC = "RESET"; SET DEBUG_SYNC = "RESET";
connection node_1; connection node_1;
SELECT COUNT(*), COUNT(*) = 0 FROM parent; SELECT * FROM parent;
COUNT(*) COUNT(*) = 0 id
0 1 SELECT * FROM child;
SELECT COUNT(*), COUNT(*) = 0 FROM child; id j parent_id
COUNT(*) COUNT(*) = 0
0 1
DROP TABLE child; DROP TABLE child;
DROP TABLE parent; DROP TABLE parent;
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
--echo # --echo #
--connection node_1 --connection node_1
set wsrep_sync_wait=0;
CREATE TABLE grandparent ( CREATE TABLE grandparent (
id INT NOT NULL PRIMARY KEY id INT NOT NULL PRIMARY KEY
...@@ -36,8 +35,12 @@ INSERT INTO parent VALUES (1,1), (2,2); ...@@ -36,8 +35,12 @@ INSERT INTO parent VALUES (1,1), (2,2);
INSERT INTO child VALUES (1,1), (2,2); INSERT INTO child VALUES (1,1), (2,2);
--connection node_2 --connection node_2
set wsrep_sync_wait=0; --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'grandparent'
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'parent'
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'child'
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM child; --let $wait_condition = SELECT COUNT(*) = 2 FROM child;
--source include/wait_condition.inc --source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM parent; --let $wait_condition = SELECT COUNT(*) = 2 FROM parent;
...@@ -46,6 +49,10 @@ set wsrep_sync_wait=0; ...@@ -46,6 +49,10 @@ set wsrep_sync_wait=0;
--source include/wait_condition.inc --source include/wait_condition.inc
DELETE FROM grandparent WHERE id = 1; DELETE FROM grandparent WHERE id = 1;
SELECT * FROM grandparent;
SELECT * FROM parent;
SELECT * FROM child;
--connection node_1 --connection node_1
--let $wait_condition = SELECT COUNT(*) = 1 FROM child; --let $wait_condition = SELECT COUNT(*) = 1 FROM child;
--source include/wait_condition.inc --source include/wait_condition.inc
...@@ -53,8 +60,10 @@ DELETE FROM grandparent WHERE id = 1; ...@@ -53,8 +60,10 @@ DELETE FROM grandparent WHERE id = 1;
--source include/wait_condition.inc --source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM grandparent; --let $wait_condition = SELECT COUNT(*) = 1 FROM grandparent;
--source include/wait_condition.inc --source include/wait_condition.inc
SELECT COUNT(*), COUNT(*) = 0 FROM parent WHERE grandparent_id = 1;
SELECT COUNT(*), COUNT(*) = 0 FROM child WHERE parent_id = 1; SELECT * FROM grandparent;
SELECT * FROM parent;
SELECT * FROM child;
DROP TABLE child; DROP TABLE child;
DROP TABLE parent; DROP TABLE parent;
......
...@@ -25,16 +25,25 @@ INSERT INTO parent VALUES ('row one'), ('row two'); ...@@ -25,16 +25,25 @@ INSERT INTO parent VALUES ('row one'), ('row two');
INSERT INTO child VALUES (1,'row one'), (2,'row two'); INSERT INTO child VALUES (1,'row one'), (2,'row two');
--connection node_2 --connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'parent'
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'child'
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM parent;
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM child; --let $wait_condition = SELECT COUNT(*) = 2 FROM child;
--source include/wait_condition.inc --source include/wait_condition.inc
DELETE FROM parent; DELETE FROM parent;
--connection node_1 --connection node_1
--let $wait_condition = SELECT COUNT(*) = 0 FROM parent;
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM child; --let $wait_condition = SELECT COUNT(*) = 0 FROM child;
--source include/wait_condition.inc --source include/wait_condition.inc
SELECT COUNT(*), COUNT(*) = 0 FROM parent; SELECT * FROM parent;
SELECT COUNT(*), COUNT(*) = 0 FROM child; SELECT * FROM child;
DROP TABLE child; DROP TABLE child;
DROP TABLE parent; DROP TABLE parent;
...@@ -61,20 +70,27 @@ CREATE TABLE child ( ...@@ -61,20 +70,27 @@ CREATE TABLE child (
INSERT INTO parent VALUES (1); INSERT INTO parent VALUES (1);
INSERT INTO child VALUES (1,0,1); INSERT INTO child VALUES (1,0,1);
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'parent'
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'child'
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM parent;
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM child;
--source include/wait_condition.inc
# block applier before applying # block applier before applying
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
--connection node_2 --connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM child;
--source include/wait_condition.inc
DELETE FROM parent; DELETE FROM parent;
--connection node_1a --connection node_1a
# wait until applier has reached the sync point # wait until applier has reached the sync point
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
--connection node_1 --connection node_1
# issue conflicting write to child table, it should fail in certification # issue conflicting write to child table, it should fail in certification
--error ER_LOCK_DEADLOCK --error ER_LOCK_DEADLOCK
...@@ -88,11 +104,13 @@ SET DEBUG_SYNC = "RESET"; ...@@ -88,11 +104,13 @@ SET DEBUG_SYNC = "RESET";
--connection node_1 --connection node_1
--reap --reap
--let $wait_condition = SELECT COUNT(*) = 0 FROM parent;
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM child; --let $wait_condition = SELECT COUNT(*) = 0 FROM child;
--source include/wait_condition.inc --source include/wait_condition.inc
SELECT COUNT(*), COUNT(*) = 0 FROM parent;
SELECT COUNT(*), COUNT(*) = 0 FROM child; SELECT * FROM parent;
SELECT * FROM child;
DROP TABLE child; DROP TABLE child;
DROP TABLE parent; DROP TABLE parent;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment