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

MDEV-17062: Test failure on galera.MW-336

MDEV-17058: Test failure on wsrep.variables
MDEV-17060: Test failure on galera.galera_var_slave_threads

Fix incorrect calculation of increased applier (slave) threads.
Note that increase change takes effect "immediately" but we should
use proper wait condition to wait it. Reducing the number of
slave threads is not immediate as thread will only exit after a
replication event.
parent b6f05502
...@@ -2,39 +2,99 @@ CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; ...@@ -2,39 +2,99 @@ CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
connection node_1; connection node_1;
SET GLOBAL wsrep_slave_threads = 10; SET GLOBAL wsrep_slave_threads = 10;
SET GLOBAL wsrep_slave_threads = 1; SET GLOBAL wsrep_slave_threads = 1;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
COUNT(*)
11
SHOW STATUS LIKE 'wsrep_thread_count';
Variable_name Value
wsrep_thread_count 11
connection node_2; connection node_2;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
connection node_1; connection node_1;
SET GLOBAL wsrep_slave_threads = 10; SET GLOBAL wsrep_slave_threads = 10;
SET GLOBAL wsrep_slave_threads = 20; SET GLOBAL wsrep_slave_threads = 20;
SET GLOBAL wsrep_slave_threads = 1; SET GLOBAL wsrep_slave_threads = 1;
connection node_2; connection node_2;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (3); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (4); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (5); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (6); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (7); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (8); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (9); INSERT INTO t1 VALUES (1);
connection node_1; INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
SET GLOBAL wsrep_slave_threads = 10; SET GLOBAL wsrep_slave_threads = 10;
SET GLOBAL wsrep_slave_threads = 0; SET GLOBAL wsrep_slave_threads = 0;
Warnings: Warnings:
Warning 1292 Truncated incorrect wsrep_slave_threads value: '0' Warning 1292 Truncated incorrect wsrep_slave_threads value: '0'
connection node_2; connection node_2;
INSERT INTO t1 VALUES (10); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (11); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (12); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (13); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (14); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (15); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (16); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (17); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (18); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (19); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (20); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
connection node_1; connection node_1;
SET GLOBAL wsrep_slave_threads = 1; SET GLOBAL wsrep_slave_threads = 1;
connection node_2;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
connection node_1;
DROP TABLE t1; DROP TABLE t1;
...@@ -8,15 +8,28 @@ ...@@ -8,15 +8,28 @@
CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB;
--connection node_1 --connection node_1
SET GLOBAL wsrep_slave_threads = 10; SET GLOBAL wsrep_slave_threads = 10;
SET GLOBAL wsrep_slave_threads = 1; SET GLOBAL wsrep_slave_threads = 1;
--let $wait_timeout=600
--let $wait_condition = SELECT COUNT(*) = 11 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%'); --let $wait_condition = SELECT COUNT(*) = 11 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
--source include/wait_condition.inc --source include/wait_condition.inc
SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
SHOW STATUS LIKE 'wsrep_thread_count';
--connection node_2 --connection node_2
INSERT INTO t1 VALUES (1); # Generate 11 replication events
--let $count = 11
while ($count)
{
INSERT INTO t1 VALUES (1);
--dec $count
}
--connection node_1 --connection node_1
SET GLOBAL wsrep_slave_threads = 10; SET GLOBAL wsrep_slave_threads = 10;
--let $wait_condition = SELECT COUNT(*) = 11 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%'); --let $wait_condition = SELECT COUNT(*) = 11 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
--source include/wait_condition.inc --source include/wait_condition.inc
...@@ -28,40 +41,40 @@ SET GLOBAL wsrep_slave_threads = 20; ...@@ -28,40 +41,40 @@ SET GLOBAL wsrep_slave_threads = 20;
SET GLOBAL wsrep_slave_threads = 1; SET GLOBAL wsrep_slave_threads = 1;
--connection node_2 --connection node_2
INSERT INTO t1 VALUES (1); # Generate 21 replication events
INSERT INTO t1 VALUES (2); --let $count = 21
INSERT INTO t1 VALUES (3); while ($count)
INSERT INTO t1 VALUES (4); {
INSERT INTO t1 VALUES (5); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (6); --dec $count
INSERT INTO t1 VALUES (7); }
INSERT INTO t1 VALUES (8);
INSERT INTO t1 VALUES (9);
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 12 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
--source include/wait_condition.inc
SET GLOBAL wsrep_slave_threads = 10; SET GLOBAL wsrep_slave_threads = 10;
SET GLOBAL wsrep_slave_threads = 0; SET GLOBAL wsrep_slave_threads = 0;
--connection node_2 --connection node_2
INSERT INTO t1 VALUES (10); # Generate 21 replication events
INSERT INTO t1 VALUES (11); --let $count = 21
INSERT INTO t1 VALUES (12); while ($count)
INSERT INTO t1 VALUES (13); {
INSERT INTO t1 VALUES (14); INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (15); --dec $count
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 --connection node_1
--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%'); --let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%');
--source include/wait_condition.inc --source include/wait_condition.inc
SET GLOBAL wsrep_slave_threads = 1; SET GLOBAL wsrep_slave_threads = 1;
--connection node_2
# Generate 21 replication events
--let $count = 21
while ($count)
{
INSERT INTO t1 VALUES (1);
--dec $count
}
--connection node_1
DROP TABLE t1; DROP TABLE t1;
...@@ -101,8 +101,10 @@ SHOW STATUS LIKE 'wsrep_thread_count'; ...@@ -101,8 +101,10 @@ SHOW STATUS LIKE 'wsrep_thread_count';
--echo # Setting wsrep_cluster_address triggers the creation of --echo # Setting wsrep_cluster_address triggers the creation of
--echo # applier/rollbacker threads. --echo # applier/rollbacker threads.
SET GLOBAL wsrep_cluster_address= 'gcomm://'; SET GLOBAL wsrep_cluster_address= 'gcomm://';
--echo # Wait for applier threads to get created. --echo # Wait for applier threads to get created.
sleep 3; --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
--source include/wait_condition.inc
--replace_regex /.*libgalera_smm.*/libgalera_smm.so/ --replace_regex /.*libgalera_smm.*/libgalera_smm.so/
SELECT @@global.wsrep_provider; SELECT @@global.wsrep_provider;
...@@ -113,8 +115,11 @@ SHOW STATUS LIKE 'wsrep_thread_count'; ...@@ -113,8 +115,11 @@ SHOW STATUS LIKE 'wsrep_thread_count';
SET @wsrep_slave_threads_saved= @@global.wsrep_slave_threads; SET @wsrep_slave_threads_saved= @@global.wsrep_slave_threads;
SET GLOBAL wsrep_slave_threads= 10; SET GLOBAL wsrep_slave_threads= 10;
--echo # Wait for applier threads to get created. --echo # Wait for applier threads to get created.
sleep 3; --let $wait_condition = SELECT VARIABLE_VALUE = 11 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
--source include/wait_condition.inc
SHOW STATUS LIKE 'threads_connected'; SHOW STATUS LIKE 'threads_connected';
SHOW STATUS LIKE 'wsrep_thread_count'; SHOW STATUS LIKE 'wsrep_thread_count';
......
...@@ -594,7 +594,9 @@ void wsrep_node_address_init (const char* value) ...@@ -594,7 +594,9 @@ void wsrep_node_address_init (const char* value)
static void wsrep_slave_count_change_update () static void wsrep_slave_count_change_update ()
{ {
wsrep_slave_count_change += (wsrep_slave_threads - wsrep_prev_slave_threads); wsrep_slave_count_change = (wsrep_slave_threads - wsrep_prev_slave_threads);
WSREP_DEBUG("Change on slave threads: New %lu old %lu difference %lu",
wsrep_slave_threads, wsrep_prev_slave_threads, wsrep_slave_count_change);
wsrep_prev_slave_threads = wsrep_slave_threads; wsrep_prev_slave_threads = wsrep_slave_threads;
} }
......
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