Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions mysql-test/r/admin_max_connections.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#
# 1. Status variables exist and start at a clean baseline
#
SHOW GLOBAL STATUS LIKE 'Admin_connection%';
Variable_name Value
Admin_connection_errors_max_connections 0
Admin_connections 0
#
# 2. Create a user allowed to use the administrative interface
#
CREATE USER u_admin;
GRANT SERVICE_CONNECTION_ADMIN ON *.* TO u_admin;
#
# 3. With the default of 0 there is no limit (previous behaviour),
# and Admin_connections counts administrative connections only
#
SHOW GLOBAL STATUS LIKE 'Admin_connections';
Variable_name Value
Admin_connections 3
# An ordinary connection must NOT change Admin_connections
SHOW GLOBAL STATUS LIKE 'Admin_connections';
Variable_name Value
Admin_connections 3
# All administrative connections are gone again
SHOW GLOBAL STATUS LIKE 'Admin_connections';
Variable_name Value
Admin_connections 0
#
# 4. With admin_max_connections = 2 the third administrative
# connection is rejected, and the rejection is counted in
# Admin_connection_errors_max_connections only
#
SET GLOBAL admin_max_connections = 2;
# Remember the normal-connection error counter to prove it stays put
SHOW GLOBAL STATUS LIKE 'Admin_connections';
Variable_name Value
Admin_connections 2
connect(127.0.0.1,u_admin,,test,ADMIN_PORT,SOURCE_SOCKET);
ERROR HY000: Too many connections
SHOW GLOBAL STATUS LIKE 'Admin_connection_errors_max_connections';
Variable_name Value
Admin_connection_errors_max_connections 1
# The rejection did not leak into Connection_errors_max_connections
# Connection_errors_max_connections unchanged: OK
#
# 5. Ordinary connections are not affected by the admin cap
#
SELECT 1 AS ordinary_connection_works;
ordinary_connection_works
1
#
# 6. Closing an administrative connection frees a slot
#
SELECT 1 AS admin_slot_freed;
admin_slot_freed
1
#
# 7. Lowering the cap below the number of open administrative
# connections affects only new connections
#
SET GLOBAL admin_max_connections = 1;
SELECT 1 AS existing_admin_conn_alive;
existing_admin_conn_alive
1
connect(127.0.0.1,u_admin,,test,ADMIN_PORT,SOURCE_SOCKET);
ERROR HY000: Too many connections
#
# 8. Setting the value back to 0 removes the limit again
#
SET GLOBAL admin_max_connections = 0;
#
# Cleanup
#
DROP USER u_admin;
SET GLOBAL admin_max_connections = DEFAULT;
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 @@ -46,17 +46,17 @@ include/assert.inc [Expect 500+ variables in the table. Due to open Bugs, we are

# Test SET PERSIST

include/assert.inc [Expect 450 persisted variables in the table.]
include/assert.inc [Expect 451 persisted variables in the table.]

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

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

************************************************************
* 4. Test RESET PERSIST IF EXISTS. Verify persisted variable
Expand Down
6 changes: 6 additions & 0 deletions mysql-test/r/mysqld--help-notwin.result
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ The following options may be given as the first argument:
System. Attempt to specify a network namespace for a
platform that doesn't support it results in error during
socket creation.
--admin-max-connections=#
The maximum number of concurrent client connections
permitted on the administrative interface
(admin_address/admin_port). 0 (the default) means no
limit.
--admin-port=# Port number to use for service connection, built-in
default (33062)
--admin-ssl-ca=name CA file in PEM format (check OpenSSL docs) for
Expand Down Expand Up @@ -1642,6 +1647,7 @@ Variables (--variable-name=value)
activate-all-roles-on-login FALSE
activate-mandatory-roles TRUE
admin-address (No default value)
admin-max-connections 0
admin-port 33062
admin-ssl-ca (No default value)
admin-ssl-capath (No default value)
Expand Down
128 changes: 128 additions & 0 deletions mysql-test/suite/sys_vars/r/admin_max_connections_basic.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
SET @start_value = @@global.admin_max_connections;
SELECT @start_value;
@start_value
0
'#--------------------FN_DYNVARS_XXX_01------------------------#'
SET @@global.admin_max_connections = 5000;
SET @@global.admin_max_connections = DEFAULT;
SELECT @@global.admin_max_connections;
@@global.admin_max_connections
0
'#---------------------FN_DYNVARS_XXX_02-------------------------#'
SET @@global.admin_max_connections = @start_value;
SELECT @@global.admin_max_connections = 0;
@@global.admin_max_connections = 0
1
'#--------------------FN_DYNVARS_XXX_03------------------------#'
SET @@global.admin_max_connections = 100000;
SELECT @@global.admin_max_connections;
@@global.admin_max_connections
100000
SET @@global.admin_max_connections = 99999;
SELECT @@global.admin_max_connections;
@@global.admin_max_connections
99999
SET @@global.admin_max_connections = 65536;
SELECT @@global.admin_max_connections;
@@global.admin_max_connections
65536
SET @@global.admin_max_connections = 0;
SELECT @@global.admin_max_connections;
@@global.admin_max_connections
0
SET @@global.admin_max_connections = 1;
SELECT @@global.admin_max_connections;
@@global.admin_max_connections
1
'#--------------------FN_DYNVARS_XXX_04-------------------------#'
SET @@global.admin_max_connections = -1;
Warnings:
Warning 1292 Truncated incorrect admin_max_connections value: '-1'
SELECT @@global.admin_max_connections;
@@global.admin_max_connections
0
SET @@global.admin_max_connections = 100000000000;
Warnings:
Warning 1292 Truncated incorrect admin_max_connections value: '100000000000'
SELECT @@global.admin_max_connections;
@@global.admin_max_connections
100000
SET @@global.admin_max_connections = 10000.01;
ERROR 42000: Incorrect argument type to variable 'admin_max_connections'
SELECT @@global.admin_max_connections;
@@global.admin_max_connections
100000
SET @@global.admin_max_connections = -1024;
Warnings:
Warning 1292 Truncated incorrect admin_max_connections value: '-1024'
SELECT @@global.admin_max_connections;
@@global.admin_max_connections
0
SET @@global.admin_max_connections = 100001;
Warnings:
Warning 1292 Truncated incorrect admin_max_connections value: '100001'
SELECT @@global.admin_max_connections;
@@global.admin_max_connections
100000
SET @@global.admin_max_connections = ON;
ERROR 42000: Incorrect argument type to variable 'admin_max_connections'
SELECT @@global.admin_max_connections;
@@global.admin_max_connections
100000
SET @@global.admin_max_connections = 'test';
ERROR 42000: Incorrect argument type to variable 'admin_max_connections'
SELECT @@global.admin_max_connections;
@@global.admin_max_connections
100000
'#-------------------FN_DYNVARS_XXX_05----------------------------#'
SET @@session.admin_max_connections = 4096;
ERROR HY000: Variable 'admin_max_connections' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@session.admin_max_connections;
ERROR HY000: Variable 'admin_max_connections' is a GLOBAL variable
'#----------------------FN_DYNVARS_XXX_06------------------------#'
SELECT @@global.admin_max_connections = VARIABLE_VALUE
FROM performance_schema.global_variables
WHERE VARIABLE_NAME='admin_max_connections';
@@global.admin_max_connections = VARIABLE_VALUE
1
SELECT @@admin_max_connections = VARIABLE_VALUE
FROM performance_schema.session_variables
WHERE VARIABLE_NAME='admin_max_connections';
@@admin_max_connections = VARIABLE_VALUE
1
'#---------------------FN_DYNVARS_XXX_07----------------------#'
SET @@global.admin_max_connections = TRUE;
SELECT @@global.admin_max_connections;
@@global.admin_max_connections
1
SET @@global.admin_max_connections = FALSE;
SELECT @@global.admin_max_connections;
@@global.admin_max_connections
0
'#---------------------FN_DYNVARS_XXX_08----------------------#'
SET @@global.admin_max_connections = 5000;
SELECT @@admin_max_connections = @@global.admin_max_connections;
@@admin_max_connections = @@global.admin_max_connections
1
'#---------------------FN_DYNVARS_XXX_09----------------------#'
SET admin_max_connections = 6000;
ERROR HY000: Variable 'admin_max_connections' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@admin_max_connections;
@@admin_max_connections
5000
SET local.admin_max_connections = 7000;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'local.admin_max_connections = 7000' at line 1
SELECT local.admin_max_connections;
ERROR 42S02: Unknown table 'local' in field list
SET global.admin_max_connections = 8000;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'global.admin_max_connections = 8000' at line 1
SELECT global.admin_max_connections;
ERROR 42S02: Unknown table 'global' in field list
SELECT admin_max_connections;
ERROR 42S22: Unknown column 'admin_max_connections' in 'field list'
SELECT @@session.admin_max_connections;
ERROR HY000: Variable 'admin_max_connections' is a GLOBAL variable
SET @@global.admin_max_connections = @start_value;
SELECT @@global.admin_max_connections;
@@global.admin_max_connections
0
Loading