forked from facebook/mysql-5.6
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mysql_thread_pool] Added test for external updates on min/max cpu ut…
…ilization Summary: Following along the lines of D38307552, adding test for tenantresourcesettings variable on the mysql side. Abandoning: D38307685 since the branch has changed as well as the variable names. Test Plan: MTR: ../tools/mysqltest.sh --record --thread-pool tenant_resource_settings_basic Reviewers: mzait, sunxiayi, greynya Reviewed By: mzait Subscribers: [email protected] Differential Revision: https://phabricator.intern.facebook.com/D38647591
- Loading branch information
Showing
2 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
mysql-test/suite/thread_pool/r/tenant_resource_settings_basic.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
create database test_db; | ||
create user test_user@localhost; | ||
grant all on test.* to test_user@localhost; | ||
grant all on test_db.* to test_user@localhost; | ||
use test_db; | ||
connect con, localhost, test_user,, test_db; | ||
connect con1, localhost, root,, test_db; | ||
select SCHEMA_NAME, CPU_MIN_PERCENT, CPU_MAX_PERCENT from information_schema.tp_admission_control_entities; | ||
SCHEMA_NAME CPU_MIN_PERCENT CPU_MAX_PERCENT | ||
test_db 0 100 | ||
__system__ 0 100 | ||
connection con1; | ||
set @@global.thread_pool_tenant_resource_settings = "test_db cpu_min_percent=0"; | ||
select SCHEMA_NAME, CPU_MIN_PERCENT, CPU_MAX_PERCENT from information_schema.tp_admission_control_entities; | ||
SCHEMA_NAME CPU_MIN_PERCENT CPU_MAX_PERCENT | ||
test_db 0 100 | ||
__system__ 0 100 | ||
set @@global.thread_pool_tenant_resource_settings = "test_db cpu_max_percent=100"; | ||
select SCHEMA_NAME, CPU_MIN_PERCENT, CPU_MAX_PERCENT from information_schema.tp_admission_control_entities; | ||
SCHEMA_NAME CPU_MIN_PERCENT CPU_MAX_PERCENT | ||
test_db 0 100 | ||
__system__ 0 100 | ||
set @@global.thread_pool_tenant_resource_settings = "test_db cpu_min_percent=20"; | ||
select SCHEMA_NAME, CPU_MIN_PERCENT, CPU_MAX_PERCENT from information_schema.tp_admission_control_entities; | ||
SCHEMA_NAME CPU_MIN_PERCENT CPU_MAX_PERCENT | ||
test_db 20 100 | ||
__system__ 0 100 | ||
set @@global.thread_pool_tenant_resource_settings = "test_db cpu_max_percent=60"; | ||
select SCHEMA_NAME, CPU_MIN_PERCENT, CPU_MAX_PERCENT from information_schema.tp_admission_control_entities; | ||
SCHEMA_NAME CPU_MIN_PERCENT CPU_MAX_PERCENT | ||
test_db 20 60 | ||
__system__ 0 100 | ||
set @@global.thread_pool_tenant_resource_settings = "test_db cpu_max_percent=101"; | ||
ERROR 42000: Variable 'thread_pool_tenant_resource_settings' can't be set to the value of 'test_db cpu_max_percent=101' | ||
select SCHEMA_NAME, CPU_MIN_PERCENT, CPU_MAX_PERCENT from information_schema.tp_admission_control_entities; | ||
SCHEMA_NAME CPU_MIN_PERCENT CPU_MAX_PERCENT | ||
test_db 20 60 | ||
__system__ 0 100 | ||
set @@global.thread_pool_tenant_resource_settings = "test_db max_percent=60"; | ||
ERROR 42000: Variable 'thread_pool_tenant_resource_settings' can't be set to the value of 'test_db max_percent=60' | ||
select SCHEMA_NAME, CPU_MIN_PERCENT, CPU_MAX_PERCENT from information_schema.tp_admission_control_entities; | ||
SCHEMA_NAME CPU_MIN_PERCENT CPU_MAX_PERCENT | ||
test_db 20 60 | ||
__system__ 0 100 | ||
set @@global.thread_pool_tenant_resource_settings = "test_db cpu_min_percent=-1"; | ||
ERROR 42000: Variable 'thread_pool_tenant_resource_settings' can't be set to the value of 'test_db cpu_min_percent=-1' | ||
select SCHEMA_NAME, CPU_MIN_PERCENT, CPU_MAX_PERCENT from information_schema.tp_admission_control_entities; | ||
SCHEMA_NAME CPU_MIN_PERCENT CPU_MAX_PERCENT | ||
test_db 20 60 | ||
__system__ 0 100 | ||
set @@global.thread_pool_tenant_resource_settings = "test_db cpu_max_percent=60 cpu_min_percent=10"; | ||
ERROR 42000: Variable 'thread_pool_tenant_resource_settings' can't be set to the value of 'test_db cpu_max_percent=60 cpu_min_percent=10' | ||
select SCHEMA_NAME, CPU_MIN_PERCENT, CPU_MAX_PERCENT from information_schema.tp_admission_control_entities; | ||
SCHEMA_NAME CPU_MIN_PERCENT CPU_MAX_PERCENT | ||
test_db 20 60 | ||
__system__ 0 100 | ||
set @@global.thread_pool_tenant_resource_settings = "__system__ cpu_min_percent=10"; | ||
ERROR 42000: Variable 'thread_pool_tenant_resource_settings' can't be set to the value of '__system__ cpu_min_percent=10' | ||
select SCHEMA_NAME, CPU_MIN_PERCENT, CPU_MAX_PERCENT from information_schema.tp_admission_control_entities; | ||
SCHEMA_NAME CPU_MIN_PERCENT CPU_MAX_PERCENT | ||
test_db 20 60 | ||
__system__ 0 100 | ||
set @@global.thread_pool_tenant_resource_settings = "test_db3 cpu_max_percent=60"; | ||
ERROR 42000: Variable 'thread_pool_tenant_resource_settings' can't be set to the value of 'test_db3 cpu_max_percent=60' | ||
select SCHEMA_NAME, CPU_MIN_PERCENT, CPU_MAX_PERCENT from information_schema.tp_admission_control_entities; | ||
SCHEMA_NAME CPU_MIN_PERCENT CPU_MAX_PERCENT | ||
test_db 20 60 | ||
__system__ 0 100 | ||
disconnect con; | ||
disconnect con1; | ||
connection default; | ||
set @@global.thread_pool_tenant_resource_settings = DEFAULT; | ||
drop database test_db; | ||
drop user test_user@localhost; |
67 changes: 67 additions & 0 deletions
67
mysql-test/suite/thread_pool/t/tenant_resource_settings_basic.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--source include/have_thread_pool_plugin.inc | ||
--source include/count_sessions.inc | ||
|
||
|
||
create database test_db; | ||
create user test_user@localhost; | ||
grant all on test.* to test_user@localhost; | ||
grant all on test_db.* to test_user@localhost; | ||
use test_db; | ||
|
||
let $ac_entities_query=select SCHEMA_NAME, CPU_MIN_PERCENT, CPU_MAX_PERCENT from information_schema.tp_admission_control_entities; | ||
|
||
enable_connect_log; | ||
|
||
connect (con, localhost, test_user,, test_db); | ||
connect (con1, localhost, root,, test_db); | ||
|
||
# Default Values | ||
eval $ac_entities_query; | ||
|
||
connection con1; | ||
|
||
set @@global.thread_pool_tenant_resource_settings = "test_db cpu_min_percent=0"; | ||
eval $ac_entities_query; | ||
|
||
set @@global.thread_pool_tenant_resource_settings = "test_db cpu_max_percent=100"; | ||
eval $ac_entities_query; | ||
|
||
set @@global.thread_pool_tenant_resource_settings = "test_db cpu_min_percent=20"; | ||
eval $ac_entities_query; | ||
|
||
set @@global.thread_pool_tenant_resource_settings = "test_db cpu_max_percent=60"; | ||
eval $ac_entities_query; | ||
|
||
--error 1231 | ||
set @@global.thread_pool_tenant_resource_settings = "test_db cpu_max_percent=101"; | ||
eval $ac_entities_query; | ||
|
||
--error 1231 | ||
set @@global.thread_pool_tenant_resource_settings = "test_db max_percent=60"; | ||
eval $ac_entities_query; | ||
|
||
--error 1231 | ||
set @@global.thread_pool_tenant_resource_settings = "test_db cpu_min_percent=-1"; | ||
eval $ac_entities_query; | ||
|
||
--error 1231 | ||
set @@global.thread_pool_tenant_resource_settings = "test_db cpu_max_percent=60 cpu_min_percent=10"; | ||
eval $ac_entities_query; | ||
|
||
--error 1231 | ||
set @@global.thread_pool_tenant_resource_settings = "__system__ cpu_min_percent=10"; | ||
eval $ac_entities_query; | ||
|
||
--error 1231 | ||
set @@global.thread_pool_tenant_resource_settings = "test_db3 cpu_max_percent=60"; | ||
eval $ac_entities_query; | ||
|
||
disconnect con; | ||
disconnect con1; | ||
connection default; | ||
|
||
set @@global.thread_pool_tenant_resource_settings = DEFAULT; | ||
|
||
drop database test_db; | ||
drop user test_user@localhost; | ||
--source include/wait_until_count_sessions.inc |