mirror of
https://github.com/MariaDB/server.git
synced 2025-11-30 05:23:50 +03:00
Problem seems to be the fact that we did not enforce correct applier thread numbers after every command that effects them. Test changes only.
121 lines
5.4 KiB
Plaintext
121 lines
5.4 KiB
Plaintext
#
|
|
# 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 VARIABLE_VALUE = 10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
|
--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
|
|
|
|
SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
|
|
|
SET GLOBAL wsrep_slave_threads = 1;
|
|
|
|
--connection node_2
|
|
INSERT INTO t1 VALUES (1);
|
|
|
|
--connection node_1
|
|
--echo # Wait until one of the appliers has exited
|
|
--let $wait_condition = SELECT VARIABLE_VALUE = 9 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
|
--let $wait_condition_on_error_output = SELECT COUNT(*), 9 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
|
|
|
|
SELECT VARIABLE_VALUE AS EXPECT_9 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
|
|
|
SET GLOBAL wsrep_slave_threads = 10;
|
|
|
|
# Note that above insert could be handled by one of the slave threads
|
|
--echo # Set slave threads to 10 step 2
|
|
--let $wait_condition = SELECT VARIABLE_VALUE = 10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
|
--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
|
|
|
|
SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
|
|
|
SET GLOBAL wsrep_slave_threads = 20;
|
|
|
|
--echo # Set slave threads to 20
|
|
--let $wait_condition = SELECT VARIABLE_VALUE = 20 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
|
--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
|
|
|
|
SELECT VARIABLE_VALUE AS EXPECT_20 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
|
|
|
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);
|
|
INSERT INTO t1 VALUES (11);
|
|
INSERT INTO t1 VALUES (12);
|
|
INSERT INTO t1 VALUES (13);
|
|
INSERT INTO t1 VALUES (14);
|
|
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
|
|
--echo # Wait until 19 of the appliers has exited
|
|
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
|
--let $wait_condition_on_error_output = SELECT COUNT(*), 1 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
|
|
|
|
SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
SET GLOBAL wsrep_slave_threads = 10;
|
|
--echo # Set slave threads to 10 step 3
|
|
--let $wait_condition = SELECT VARIABLE_VALUE = 10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
|
--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
|
|
|
|
SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
|
|
|
--connection node_1
|
|
SET GLOBAL wsrep_slave_threads = 1;
|
|
|
|
--connection node_2
|
|
INSERT INTO t1 VALUES (21);
|
|
INSERT INTO t1 VALUES (22);
|
|
INSERT INTO t1 VALUES (23);
|
|
INSERT INTO t1 VALUES (24);
|
|
INSERT INTO t1 VALUES (25);
|
|
INSERT INTO t1 VALUES (26);
|
|
INSERT INTO t1 VALUES (27);
|
|
INSERT INTO t1 VALUES (28);
|
|
INSERT INTO t1 VALUES (29);
|
|
INSERT INTO t1 VALUES (30);
|
|
|
|
--connection node_1
|
|
--echo # Wait until slave threads back to 1
|
|
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
|
--let $wait_condition_on_error_output = SELECT COUNT(*), 1 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
|
|
|
|
SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
DROP TABLE t1;
|