Commit 44a11a7c authored by Jan Lindström's avatar Jan Lindström

MDEV-20780 : Galera test failure on galera_sr.galera_sr_ddl_master

Fix wait_condition and use repeatable read with wsrep_sync at the
end.
parent 57b666b2
...@@ -12,17 +12,18 @@ INSERT INTO t1 VALUES (4); ...@@ -12,17 +12,18 @@ INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (5); INSERT INTO t1 VALUES (5);
connection node_2; connection node_2;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
COUNT(*) > 0 SELECT COUNT(*) as expect_5 FROM mysql.wsrep_streaming_log;
1 expect_5
5
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
ALTER TABLE t1 ADD COLUMN f2 INTEGER; ALTER TABLE t1 ADD COLUMN f2 INTEGER;
connection node_1; connection node_1;
INSERT INTO t1 VALUES (6); INSERT INTO t1 VALUES (6);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
COUNT(*) = 0 expect_0
1 0
ROLLBACK; ROLLBACK;
START TRANSACTION; START TRANSACTION;
INSERT INTO t1 (f1) VALUES (1); INSERT INTO t1 (f1) VALUES (1);
...@@ -32,17 +33,34 @@ INSERT INTO t1 (f1) VALUES (4); ...@@ -32,17 +33,34 @@ INSERT INTO t1 (f1) VALUES (4);
INSERT INTO t1 (f1) VALUES (5); INSERT INTO t1 (f1) VALUES (5);
INSERT INTO t1 (f1) VALUES (6); INSERT INTO t1 (f1) VALUES (6);
COMMIT; COMMIT;
SELECT COUNT(*) = 6 FROM t1; SELECT COUNT(*) as expect_6 FROM t1;
COUNT(*) = 6 expect_6
1 6
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; SELECT * FROM t1;
COUNT(*) = 0 f1 f2
1 1 NULL
2 NULL
3 NULL
4 NULL
5 NULL
6 NULL
SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
expect_0
0
connection node_2; connection node_2;
SELECT COUNT(*) = 6 FROM t1; set global wsrep_sync_wait=15;
COUNT(*) = 6 SELECT COUNT(*) as expect_6 FROM t1;
1 expect_6
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; 6
COUNT(*) = 0 SELECT * FROM t1;
1 f1 f2
1 NULL
2 NULL
3 NULL
4 NULL
5 NULL
6 NULL
SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
expect_0
0
DROP TABLE t1; DROP TABLE t1;
...@@ -27,10 +27,11 @@ INSERT INTO t1 VALUES (5); ...@@ -27,10 +27,11 @@ INSERT INTO t1 VALUES (5);
--connection node_2 --connection node_2
# SR replication is triggered and rows have been delivered to the slave # SR replication is triggered and rows have been delivered to the slave
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
--let $wait_condition = SELECT COUNT(*) > 0 FROM t1; --let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
--source include/wait_condition.inc --source include/wait_condition.inc
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; SELECT COUNT(*) as expect_5 FROM mysql.wsrep_streaming_log;
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
ALTER TABLE t1 ADD COLUMN f2 INTEGER; ALTER TABLE t1 ADD COLUMN f2 INTEGER;
...@@ -39,7 +40,7 @@ ALTER TABLE t1 ADD COLUMN f2 INTEGER; ...@@ -39,7 +40,7 @@ ALTER TABLE t1 ADD COLUMN f2 INTEGER;
--error ER_LOCK_DEADLOCK --error ER_LOCK_DEADLOCK
INSERT INTO t1 VALUES (6); INSERT INTO t1 VALUES (6);
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
# Check that the transaction thus aborted could be reissued # Check that the transaction thus aborted could be reissued
...@@ -53,11 +54,14 @@ INSERT INTO t1 (f1) VALUES (5); ...@@ -53,11 +54,14 @@ INSERT INTO t1 (f1) VALUES (5);
INSERT INTO t1 (f1) VALUES (6); INSERT INTO t1 (f1) VALUES (6);
COMMIT; COMMIT;
SELECT COUNT(*) = 6 FROM t1; SELECT COUNT(*) as expect_6 FROM t1;
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; SELECT * FROM t1;
SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
--connection node_2 --connection node_2
SELECT COUNT(*) = 6 FROM t1; set global wsrep_sync_wait=15;
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; SELECT COUNT(*) as expect_6 FROM t1;
SELECT * FROM t1;
SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
DROP TABLE t1; DROP TABLE t1;
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