Skip to content

Commit

Permalink
Merge pull request #263 from Winston-leon/8.0.25-schedaffinity
Browse files Browse the repository at this point in the history
* mysql-8.0.25-sched-affinity
  • Loading branch information
liuwei-ck authored Aug 24, 2022
2 parents 8ccc217 + ea824b8 commit e43324f
Show file tree
Hide file tree
Showing 13 changed files with 1,722 additions and 29 deletions.
6 changes: 6 additions & 0 deletions mysql-test/include/mtr_warnings.sql
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,12 @@ INSERT INTO global_suppressions VALUES
*/
("Manifest file '.*' is not read-only. For better security, please make sure that the file is read-only."),

/*
sched affinity
*/
("libnuma test fail."),
("numa_available test fail."),

("THE_LAST_SUPPRESSION");


Expand Down
8 changes: 8 additions & 0 deletions mysql-test/include/query_sched_affinity_sys_var.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SHOW VARIABLES LIKE 'sched_affinity_foreground_thread';
SHOW VARIABLES LIKE 'sched_affinity_log_writer';
SHOW VARIABLES LIKE 'sched_affinity_log_flusher';
SHOW VARIABLES LIKE 'sched_affinity_log_write_notifier';
SHOW VARIABLES LIKE 'sched_affinity_log_flush_notifier';
SHOW VARIABLES LIKE 'sched_affinity_log_checkpointer';
SHOW VARIABLES LIKE 'sched_affinity_purge_coordinator';
SHOW VARIABLES LIKE 'sched_affinity_numa_aware';
197 changes: 197 additions & 0 deletions mysql-test/include/sched_affinity_manager.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
if (!$target_sched_affinity_group_number) {
--skip should specify target_sched_affinity_group_number
}

if (!$target_sched_affinity_group_capacity) {
--skip should specify target_sched_affinity_group_capacity
}

--let $sched_affinity_group_number = `SELECT variable_value FROM performance_schema.global_status WHERE variable_name='Sched_affinity_group_number'`
if ($sched_affinity_group_number < $target_sched_affinity_group_number) {
--skip $sched_affinity_group_number less than target_sched_affinity_group_number $target_sched_affinity_group_number
}

--let $sched_affinity_group_capacity = `SELECT variable_value FROM performance_schema.global_status WHERE variable_name='Sched_affinity_group_capacity'`
if ($sched_affinity_group_capacity != $target_sched_affinity_group_capacity) {
--skip $sched_affinity_group_capacity not equal target_sched_affinity_group_capacity $target_sched_affinity_group_capacity
}

--echo # default config
--source include/query_sched_affinity_sys_var.inc

--echo # set foreground sys_var
--let $restart_parameters="restart: --sched_affinity_foreground_thread=0-3,5,6"
--source include/restart_mysqld.inc
--source include/query_sched_affinity_sys_var.inc

--echo # set log_writer sys_var
--let $restart_parameters="restart: --sched_affinity_log_writer=4"
--source include/restart_mysqld.inc
--source include/query_sched_affinity_sys_var.inc

--echo # set foreground sys_var and log_writer sys_var
--let $restart_parameters="restart: --sched_affinity_foreground_thread=0-3,5,6 --sched_affinity_log_writer=4"
--source include/restart_mysqld.inc
--source include/query_sched_affinity_sys_var.inc

--echo # set foreground sys_var, log_writer sys_var and numa_aware sys_var
--let $restart_parameters="restart: --sched_affinity_foreground_thread=0-3,5,6 --sched_affinity_log_writer=4 --sched_affinity_numa_aware=ON"
--source include/restart_mysqld.inc
--source include/query_sched_affinity_sys_var.inc

--echo # test foreground thread group
--let $group1=0,1,2
--let $range=1
--let $group2_from=$sched_affinity_group_capacity
--expr $group2_to=$sched_affinity_group_capacity + $range
--let $restart_parameters="restart: --sched_affinity_foreground_thread=$group1,$group2_from-$group2_to"
--source include/restart_mysqld.inc
--source include/query_sched_affinity_sys_var.inc

--let $i=0
--let $connection_number = 100
while ($i<$connection_number)
{
--connect(conn$i,localhost,root,,)
--connection default
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';
--inc $i
}

--let $i=0
while ($i<$connection_number)
{
--disconnect conn$i
--connection default
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';
--inc $i
}

--echo # test foreground thread group with numa_aware
--let $group1=0,1,2
--let $range=1
--let $group2_from=$sched_affinity_group_capacity
--expr $group2_to=$sched_affinity_group_capacity + $range
--let $restart_parameters="restart: --sched_affinity_foreground_thread=$group1,$group2_from-$group2_to --sched_affinity_numa_aware=ON"
--source include/restart_mysqld.inc
--source include/query_sched_affinity_sys_var.inc

--let $i=0
--let $connection_number = 100
while ($i<$connection_number)
{
--connect(conn$i,localhost,root,,)
--connection default
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';
--inc $i
}

--let $i=0
while ($i<$connection_number)
{
--disconnect conn$i
--connection default
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';
--inc $i
}

--echo # Change sched_affinity related system variables

--let $group1=0,1,2
--eval SET GLOBAL sched_affinity_foreground_thread='$group1';
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';

--eval SET GLOBAL sched_affinity_foreground_thread="";
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';

--let $group1=0,1,2
--let $range=1
--let $group2_from=$sched_affinity_group_capacity
--expr $group2_to=$sched_affinity_group_capacity + $range
--eval SET GLOBAL sched_affinity_foreground_thread='$group1,$group2_from-$group2_to';
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';

--error ER_INVALID_CPU_STRING
--eval SET GLOBAL sched_affinity_foreground_thread='???';

--let $i=0
--let $connection_number = 100
while ($i<$connection_number)
{
--connect(conn$i,localhost,root,,)
--connection default
--inc $i
}
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';

--let $range=1
--let $group2_from=$sched_affinity_group_capacity
--expr $group2_to=$sched_affinity_group_capacity + $range
--eval SET GLOBAL sched_affinity_foreground_thread='$group2_from-$group2_to';
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';

--error ER_INVALID_CPU_STRING
--eval SET GLOBAL sched_affinity_foreground_thread='???';

--error ER_INVALID_CPU_STRING
--eval SET GLOBAL sched_affinity_foreground_thread='1-100000';

--eval SET GLOBAL sched_affinity_foreground_thread='';
--eval SET GLOBAL sched_affinity_foreground_thread='';

--let $group1=0,1,2
--let $range=1
--let $group2_from=$sched_affinity_group_capacity
--expr $group2_to=$sched_affinity_group_capacity + $range
--eval SET GLOBAL sched_affinity_foreground_thread='$group1,$group2_from-$group2_to';
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';

--let $group1=0
--let $range=6
--let $group2_from=$sched_affinity_group_capacity
--expr $group2_to=$sched_affinity_group_capacity + $range
--eval SET GLOBAL sched_affinity_foreground_thread='$group1,$group2_from-$group2_to';
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';

--let $range=1
--let $group2_from=$sched_affinity_group_capacity
--expr $group2_to=$sched_affinity_group_capacity + $range
--eval SET GLOBAL sched_affinity_foreground_thread='$group2_from-$group2_to';
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';

--eval SET GLOBAL sched_affinity_foreground_thread="";
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';

--eval SET GLOBAL sched_affinity_numa_aware=0;
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';

--eval SET GLOBAL sched_affinity_numa_aware=1;
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';

--eval SET GLOBAL sched_affinity_numa_aware=0;
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';

--let $group1=0,1,2
--let $range=1
--let $group2_from=$sched_affinity_group_capacity
--expr $group2_to=$sched_affinity_group_capacity + $range
--eval SET GLOBAL sched_affinity_foreground_thread='$group1,$group2_from-$group2_to';
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';

--eval SET GLOBAL sched_affinity_numa_aware=0;
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';

--eval SET GLOBAL sched_affinity_numa_aware=1;
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';

--eval SET GLOBAL sched_affinity_numa_aware=0;
SELECT SUBSTRING_INDEX(variable_value,';',2) from performance_schema.global_status WHERE variable_name='Sched_affinity_status';

--echo # Clean up
--let $i=0
while ($i<$connection_number)
{
--disconnect conn$i
--connection default
--inc $i
}
8 changes: 4 additions & 4 deletions mysql-test/r/all_persisted_variables.result
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ include/assert.inc [Expect 500+ variables in the table. Due to open Bugs, we are

# Test SET PERSIST

include/assert.inc [Expect 412 persisted variables in the table.]
include/assert.inc [Expect 420 persisted variables in the table.]

************************************************************
* 3. Restart server, it must preserve the persisted variable
* settings. Verify persisted configuration.
************************************************************
# restart

include/assert.inc [Expect 412 persisted variables in persisted_variables table.]
include/assert.inc [Expect 412 persisted variables shown as PERSISTED in variables_info table.]
include/assert.inc [Expect 412 persisted variables with matching peristed and global values.]
include/assert.inc [Expect 420 persisted variables in persisted_variables table.]
include/assert.inc [Expect 420 persisted variables shown as PERSISTED in variables_info table.]
include/assert.inc [Expect 420 persisted variables with matching peristed and global values.]

************************************************************
* 4. Test RESET PERSIST IF EXISTS. Verify persisted variable
Expand Down
28 changes: 28 additions & 0 deletions mysql-test/r/mysqld--help-notwin.result
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,26 @@ The following options may be given as the first argument:
returning a warning.
--safe-user-create Don't allow new user creation by the user who has no
write privileges to the mysql.user table.
--sched-affinity-foreground-thread=name
The set of cpus which foreground threads will run on.
--sched-affinity-log-checkpointer=name
The set of cpus which log checkpointer thread will run
on.
--sched-affinity-log-flush-notifier=name
The set of cpus which log flush notifier thread will run
on.
--sched-affinity-log-flusher=name
The set of cpus which log flusher thread will run on.
--sched-affinity-log-write-notifier=name
The set of cpus which log write notifier thread will run
on.
--sched-affinity-log-writer=name
The set of cpus which log writer thread will run on.
--sched-affinity-numa-aware
Schedule threads with numa information
--sched-affinity-purge-coordinator=name
The set of cpus which purge coordinator thread will run
on.
--schema-definition-cache=#
The number of cached schema definitions
--secondary-engine-cost-threshold[=#]
Expand Down Expand Up @@ -1776,6 +1796,14 @@ require-secure-transport FALSE
rpl-read-size 8192
rpl-stop-slave-timeout 31536000
safe-user-create FALSE
sched-affinity-foreground-thread (No default value)
sched-affinity-log-checkpointer (No default value)
sched-affinity-log-flush-notifier (No default value)
sched-affinity-log-flusher (No default value)
sched-affinity-log-write-notifier (No default value)
sched-affinity-log-writer (No default value)
sched-affinity-numa-aware FALSE
sched-affinity-purge-coordinator (No default value)
schema-definition-cache 256
secondary-engine-cost-threshold 100000
select-into-buffer-size 131072
Expand Down
Loading

0 comments on commit e43324f

Please sign in to comment.