Commit 9953588a authored by Daniele Sciascia's avatar Daniele Sciascia

MDEV-13549 Fix and re-enable MTR test galera.MW-366

Test galera.MW-366 is not deterministic and depends on timing assumptions.
The test occasionally fails after checking the number of 'system user'
processes in processlist after changing the value of variable global
wsrep_slave_threads, like this:
```
SET GLOBAL wsrep_slave_threads = x;
--sleep 0.5
SELECT COUNT(*) = x FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
```

The problem is that the number of slave threads is internally adjusted
'asynchronously', and it may take some time to spawn/kill new threads,
especially in a heavily loaded system.

This patch removes the '--sleep 0.5' statements from the test and replaces
those with appropriate wait conditions, like this:
```
SET GLOBAL wsrep_slave_threads = x;
let $wait_condition = SLECT COUNT(*) = x FROM ...;
--source include/wait_condition.inc
```
parent 90051082
......@@ -9,7 +9,6 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
MW-336 : MDEV-13549 Galera test failures
galera_gra_log : MDEV-13549 Galera test failures
galera_flush_local : MDEV-13549 Galera test failures
galera_flush : MDEV-13549 Galera test failures
......
......@@ -3,13 +3,7 @@ SET GLOBAL wsrep_slave_threads = 10;
SET GLOBAL wsrep_slave_threads = 1;
INSERT INTO t1 VALUES (1);
SET GLOBAL wsrep_slave_threads = 10;
SELECT COUNT(*) = 11 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
COUNT(*) = 11
1
SET GLOBAL wsrep_slave_threads = 20;
SELECT COUNT(*) = 21 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
COUNT(*) = 21
1
SET GLOBAL wsrep_slave_threads = 1;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
......@@ -35,8 +29,5 @@ INSERT INTO t1 VALUES (17);
INSERT INTO t1 VALUES (18);
INSERT INTO t1 VALUES (19);
INSERT INTO t1 VALUES (20);
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
COUNT(*) = 2
1
SET GLOBAL wsrep_slave_threads = 1;
DROP TABLE t1;
......@@ -10,20 +10,20 @@ CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
--connection node_1
SET GLOBAL wsrep_slave_threads = 10;
SET GLOBAL wsrep_slave_threads = 1;
--let $wait_condition = SELECT COUNT(*) = 11 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
--source include/wait_condition.inc
--connection node_2
INSERT INTO t1 VALUES (1);
--connection node_1
--sleep 0.5
SET GLOBAL wsrep_slave_threads = 10;
--sleep 0.5
SELECT COUNT(*) = 11 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
--let $wait_condition = SELECT COUNT(*) = 11 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
--source include/wait_condition.inc
SET GLOBAL wsrep_slave_threads = 20;
--sleep 0.5
SELECT COUNT(*) = 21 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
--let $wait_condition = SELECT COUNT(*) = 21 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
--source include/wait_condition.inc
SET GLOBAL wsrep_slave_threads = 1;
......@@ -40,6 +40,9 @@ INSERT INTO t1 VALUES (9);
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 12 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
--source include/wait_condition.inc
SET GLOBAL wsrep_slave_threads = 10;
SET GLOBAL wsrep_slave_threads = 0;
......@@ -57,8 +60,8 @@ INSERT INTO t1 VALUES (19);
INSERT INTO t1 VALUES (20);
--connection node_1
--sleep 0.5
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user';
--source include/wait_condition.inc
SET GLOBAL wsrep_slave_threads = 1;
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