summaryrefslogtreecommitdiff
path: root/mysql-test/suite/galera/t/MW-336.test
blob: b6df78ac7a6c346e0a8b27a1e70cbf56beaf6694 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#
# MW-336 Slave threads may leak if variable wsrep_slave_threads is set repeatedly
#

--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/force_restart.inc

--connection node_1
CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;

SET GLOBAL wsrep_slave_threads = 10;

# ensure that the threads have actually started running
--echo # Set slave threads to 10 step 1
--let $wait_condition = SELECT COUNT(*) = 10 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle';
--let $wait_condition_on_error_output = SELECT COUNT(*), 10 as EXPECTED_VALUE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; show processlist
--source include/wait_condition_with_debug.inc

SET GLOBAL wsrep_slave_threads = 1;

--connection node_2
INSERT INTO t1 VALUES (1);

--connection node_1
SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) FROM t1;

SET GLOBAL wsrep_slave_threads = 10;

--echo # Set slave threads to 10 step 2
--let $wait_condition = SELECT COUNT(*) = 10 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle';
--let $wait_condition_on_error_output = SELECT COUNT(*), 10 as EXPECTED_VALUE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; show processlist
--source include/wait_condition_with_debug.inc

SET GLOBAL wsrep_slave_threads = 20;

--echo # Set slave threads to 20
--let $wait_condition = SELECT COUNT(*) = 20 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle';
--let $wait_condition_on_error_output = SELECT COUNT(*), 20 as EXPECTED_VALUE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; show processlist
--source include/wait_condition_with_debug.inc

SET GLOBAL wsrep_slave_threads = 1;

--connection node_2
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (5);
INSERT INTO t1 VALUES (6);
INSERT INTO t1 VALUES (7);
INSERT INTO t1 VALUES (8);
INSERT INTO t1 VALUES (9);
INSERT INTO t1 VALUES (10);

--connection node_1
SET GLOBAL wsrep_slave_threads = 10;
SELECT COUNT(*) FROM t1;
--echo # Set slave threads to 10 step 3
--let $wait_condition = SELECT COUNT(*) = 10 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle';
--let $wait_condition_on_error_output = SELECT COUNT(*), 10 as EXPECTED_VALUE FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep applier idle'; show processlist
--source include/wait_condition_with_debug.inc

--connection node_2
INSERT INTO t1 VALUES (11);
INSERT INTO t1 VALUES (12);
INSERT INTO t1 VALUES (13);
INSERT INTO t1 VALUES (14);
INSERT INTO t1 VALUES (15);
INSERT INTO t1 VALUES (16);
INSERT INTO t1 VALUES (17);
INSERT INTO t1 VALUES (18);
INSERT INTO t1 VALUES (19);
INSERT INTO t1 VALUES (20);

--connection node_1
SELECT COUNT(*) FROM t1;
SET GLOBAL wsrep_slave_threads = 1;
DROP TABLE t1;