Skip to content

Commit a4de2e8

Browse files
mzaitfacebook-github-bot
authored andcommittedApr 30, 2019
T43598383 - Expose nonsuper_connections as a new status variable
Summary: T43598383 - Expose nonsuper_connections as a new status variable Differential Revision: D15133730 fbshipit-source-id: 92c0147
1 parent 284346c commit a4de2e8

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed
 

‎mysql-test/r/max_nonsuper_connections.result

+12
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ SET @@global.max_nonsuper_connections = 10;
77
SELECT @@global.max_nonsuper_connections;
88
@@global.max_nonsuper_connections
99
10
10+
SHOW GLOBAL STATUS like 'Non_super_connections';
11+
Variable_name Value
12+
Non_super_connections 0
1013
connection default;
1114
connect con$i, localhost, test_user,,test;
1215
connect con$i, localhost, test_user,,test;
@@ -25,13 +28,19 @@ connection con_root;
2528
SELECT @@global.max_nonsuper_connections;
2629
@@global.max_nonsuper_connections
2730
10
31+
SHOW GLOBAL STATUS like 'Non_super_connections';
32+
Variable_name Value
33+
Non_super_connections 10
2834
disconnect con_root;
2935
connection default;
3036
connect con_super, localhost, super_user,,test;
3137
connection con_super;
3238
SELECT @@global.max_nonsuper_connections;
3339
@@global.max_nonsuper_connections
3440
10
41+
SHOW GLOBAL STATUS like 'Non_super_connections';
42+
Variable_name Value
43+
Non_super_connections 10
3544
mysqltest: At line 1: change user failed: Too many connections
3645
disconnect con_super;
3746
connection con10;
@@ -88,6 +97,9 @@ SET @@global.max_nonsuper_connections = @start_value;
8897
SELECT @@global.max_nonsuper_connections;
8998
@@global.max_nonsuper_connections
9099
0
100+
SHOW GLOBAL STATUS like 'Non_super_connections';
101+
Variable_name Value
102+
Non_super_connections 10
91103
drop user test_user@localhost;
92104
drop user super_user@localhost;
93105
disconnect con10;

‎mysql-test/t/max_nonsuper_connections.test

+6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ SET @start_value = @@global.max_nonsuper_connections;
88

99
SET @@global.max_nonsuper_connections = 10;
1010
SELECT @@global.max_nonsuper_connections;
11+
SHOW GLOBAL STATUS like 'Non_super_connections';
1112

1213
enable_connect_log;
1314
connection default;
@@ -37,6 +38,8 @@ connect (con_root, localhost, root,,test);
3738
--echo # connection con_root
3839
connection con_root;
3940
SELECT @@global.max_nonsuper_connections;
41+
SHOW GLOBAL STATUS like 'Non_super_connections';
42+
4043
disconnect con_root;
4144
connection default;
4245

@@ -46,6 +49,7 @@ connection default;
4649
connect (con_super, localhost, super_user,,test);
4750
connection con_super;
4851
SELECT @@global.max_nonsuper_connections;
52+
SHOW GLOBAL STATUS like 'Non_super_connections';
4953

5054
#
5155
# change admin user to regular user in the current connection will fail
@@ -127,6 +131,8 @@ enable_query_log;
127131
connection default;
128132
SET @@global.max_nonsuper_connections = @start_value;
129133
SELECT @@global.max_nonsuper_connections;
134+
SHOW GLOBAL STATUS like 'Non_super_connections';
135+
130136
drop user test_user@localhost;
131137
drop user super_user@localhost;
132138
let $i= 10;

‎sql/mysqld.cc

+1
Original file line numberDiff line numberDiff line change
@@ -10492,6 +10492,7 @@ SHOW_VAR status_vars[]= {
1049210492
{"Max_statement_time_exceeded", (char*) offsetof(STATUS_VAR, max_statement_time_exceeded), SHOW_LONG_STATUS},
1049310493
{"Max_statement_time_set", (char*) offsetof(STATUS_VAR, max_statement_time_set), SHOW_LONG_STATUS},
1049410494
{"Max_statement_time_set_failed", (char*) offsetof(STATUS_VAR, max_statement_time_set_failed), SHOW_LONG_STATUS},
10495+
{"Non_super_connections", (char*) &nonsuper_connections, SHOW_INT},
1049510496
{"Not_flushed_delayed_rows", (char*) &delayed_rows_in_use, SHOW_LONG_NOFLUSH},
1049610497
{"Open_files", (char*) &my_file_opened, SHOW_LONG_NOFLUSH},
1049710498
{"Open_streams", (char*) &my_stream_opened, SHOW_LONG_NOFLUSH},

0 commit comments

Comments
 (0)