1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-5289: master server starts slave parallel threads

Delay spawning parallel replication worker threads until a slave SQL
thread is running, and de-spawn them when the last SQL thread stops.

This is especially useful to avoid needless threads on a master in a
setup where same my.cnf is used on masters and slaves.
This commit is contained in:
Kristian Nielsen
2015-03-11 09:18:16 +01:00
parent a7fd11b31d
commit ed04c40b01
11 changed files with 116 additions and 53 deletions

View File

@ -2,13 +2,20 @@
SET @save_slave_parallel_threads= @@GLOBAL.slave_parallel_threads;
SELECT @@GLOBAL.slave_parallel_threads as 'must be zero because of default';
# Check that we don't spawn worker threads at server startup, when no
# slave is configured (MDEV-5289).
SELECT IF(COUNT(*) < 20, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user";
SELECT @@GLOBAL.slave_parallel_threads as 'must be 20 because of .cnf';
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@SESSION.slave_parallel_threads as 'no session var';
SET GLOBAL slave_parallel_threads= 0;
SET GLOBAL slave_parallel_threads= DEFAULT;
SELECT @@GLOBAL.slave_parallel_threads as 'must be 0 because of default';
SET GLOBAL slave_parallel_threads= 10;
SELECT @@GLOBAL.slave_parallel_threads;
# Check that we don't spawn worker threads when no slave is started.
SELECT IF(COUNT(*) < 10, "OK", CONCAT("Found too many system user processes: ", COUNT(*))) FROM information_schema.processlist WHERE user = "system user";
SET GLOBAL slave_parallel_threads = @save_slave_parallel_threads;