Skip to content

Commit c53bf24

Browse files
mzaitfacebook-github-bot
authored andcommitted
Expose nonsuper_connections as a new status variable (#1070)
Summary: Expose nonsuper_connections as a new status variable Squash with D13987618 Reference Patch: a4de2e872ca Pull Request resolved: #1070 Reviewed By: yizhang82 Differential Revision: D19161994 Pulled By: mzait fbshipit-source-id: e6be893
1 parent 8a269ee commit c53bf24

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

mysql-test/r/max_nonsuper_connections.result

+10
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ SET @@global.max_nonsuper_connections = 10;
77
SELECT @@global.max_nonsuper_connections;
88
@@global.max_nonsuper_connections
99
10
10+
include/assert.inc [Non_super_connections should be 0]
1011
connection default;
1112
connect con$i, localhost, test_user,,test;
1213
connect con$i, localhost, test_user,,test;
@@ -25,13 +26,19 @@ connection con_root;
2526
SELECT @@global.max_nonsuper_connections;
2627
@@global.max_nonsuper_connections
2728
10
29+
include/assert.inc [Non_super_connections should be 10]
30+
connection con_root;
31+
connection con_root;
2832
disconnect con_root;
2933
connection default;
3034
connect con_super, localhost, super_user,,test;
3135
connection con_super;
3236
SELECT @@global.max_nonsuper_connections;
3337
@@global.max_nonsuper_connections
3438
10
39+
include/assert.inc [Non_super_connections should be 10]
40+
connection con_super;
41+
connection con_super;
3542
mysqltest: At line 1: Query 'change_user test_user' failed.
3643
ERROR 1040 (08004): Too many connections
3744
disconnect con_super;
@@ -89,6 +96,9 @@ SET @@global.max_nonsuper_connections = @start_value;
8996
SELECT @@global.max_nonsuper_connections;
9097
@@global.max_nonsuper_connections
9198
0
99+
include/assert.inc [Non_super_connections should be 10]
100+
connection default;
101+
connection default;
92102
drop user test_user@localhost;
93103
drop user super_user@localhost;
94104
disconnect con10;

mysql-test/t/max_nonsuper_connections.test

+14
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ SET @start_value = @@global.max_nonsuper_connections;
1111

1212
SET @@global.max_nonsuper_connections = 10;
1313
SELECT @@global.max_nonsuper_connections;
14+
--let $assert_text= Non_super_connections should be 0
15+
--let $assert_cond= "[SHOW GLOBAL STATUS like \'Non_super_connections\', Value, 1]" = "0"
16+
--source include/assert.inc
1417

1518
enable_connect_log;
1619
connection default;
@@ -40,6 +43,10 @@ connect (con_root, localhost, root,,test);
4043
--echo # connection con_root
4144
connection con_root;
4245
SELECT @@global.max_nonsuper_connections;
46+
--let $assert_text= Non_super_connections should be 10
47+
--let $assert_cond= "[SHOW GLOBAL STATUS like \'Non_super_connections\', Value, 1]" = "10"
48+
--source include/assert.inc
49+
4350
disconnect con_root;
4451
connection default;
4552

@@ -49,6 +56,9 @@ connection default;
4956
connect (con_super, localhost, super_user,,test);
5057
connection con_super;
5158
SELECT @@global.max_nonsuper_connections;
59+
--let $assert_text= Non_super_connections should be 10
60+
--let $assert_cond= "[SHOW GLOBAL STATUS like \'Non_super_connections\', Value, 1]" = "10"
61+
--source include/assert.inc
5262

5363
#
5464
# change admin user to regular user in the current connection will fail
@@ -129,6 +139,10 @@ enable_query_log;
129139
connection default;
130140
SET @@global.max_nonsuper_connections = @start_value;
131141
SELECT @@global.max_nonsuper_connections;
142+
--let $assert_text= Non_super_connections should be 10
143+
--let $assert_cond= "[SHOW GLOBAL STATUS like \'Non_super_connections\', Value, 1]" = "10"
144+
--source include/assert.inc
145+
132146
drop user test_user@localhost;
133147
drop user super_user@localhost;
134148
let $i= 10;

sql/mysqld.cc

+2
Original file line numberDiff line numberDiff line change
@@ -8970,6 +8970,8 @@ SHOW_VAR status_vars[] = {
89708970
SHOW_SCOPE_GLOBAL},
89718971
{"Max_used_connections_time", (char *)&show_max_used_connections_time,
89728972
SHOW_FUNC, SHOW_SCOPE_GLOBAL},
8973+
{"Non_super_connections", (char *)&nonsuper_connections, SHOW_LONG,
8974+
SHOW_SCOPE_GLOBAL},
89738975
{"Not_flushed_delayed_rows", (char *)&delayed_rows_in_use,
89748976
SHOW_LONG_NOFLUSH, SHOW_SCOPE_GLOBAL},
89758977
{"Open_files", (char *)&my_file_opened, SHOW_LONG_NOFLUSH,

0 commit comments

Comments
 (0)