-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
MDEV-23283 User Statistics does not correctly reflect concurrent_conn… #4281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MDEV-23283 User Statistics does not correctly reflect concurrent_conn… #4281
Conversation
5337968
to
d0667f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generally, ok, but see comments and questions below
3e526fd
to
9ff4409
Compare
Cherry-picks mysqltest.cc and rpl_semi_sync_shutdown_await_ack changes from 12.1 to fix a race condition on disconnect.
…ections Keep concurrent_connections updated when user stats are enabled. When a user connects, the count in concurrent_connections increases by one; when they disconnect, it decreases by one. Setting the global userstat begins counting new concurrent sessions from that point forward; pre-existing concurrent sessions are not counted until they are restarted. Ideally this configuration is set in the my.cnf file so as to apply from server startup, ensuring that the counter is consistent. If it is set during the server's lifetime (via SET GLOBAL userstat=1) it is recommended to do so before concurrent user sessions exist for accurate counts.
2db9ac9
to
a3f3fdf
Compare
cee13cb
to
7648f7a
Compare
# an additional util connection and other statistics data | ||
-- source include/no_view_protocol.inc | ||
# Skip this test for ps protocol because commit bead24b changes the expected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it change? how?
also, don't say "commit bead24b" because it's in a much later branch. I'd just say "because the previous commit", presuming you've put the cherry-pick in a separate commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It increases the bytes_received
count by 14:
--- /home/code/5-server/mysql-test/main/userstat-badlogin-4824.result 2025-09-09 00:31:50.920752336 -0400
+++ /home/code/5-server/mysql-test/main/userstat-badlogin-4824.reject 2025-09-09 11:04:48.198199839 -0400
@@ -10,13 +10,13 @@
connection default;
select user, bytes_received from information_schema.user_statistics where user = 'foo';
user bytes_received
-foo 18
+foo 32
connect(localhost,foo,bar,test,MASTER_PORT,MASTER_SOCKET);
connect foo, localhost, foo, bar, test;
ERROR 28000: Access denied for user 'foo'@'localhost' (using password: YES)
connection default;
select user, bytes_received from information_schema.user_statistics where user = 'foo';
user bytes_received
-foo 18
+foo 32
drop user foo@localhost;
set global userstat=@save_userstat;
af84003
to
3487500
Compare
…ections
Keep concurrent_connections updated when user stats are enabled. When a user connects, the count in concurrent_connections increases by one; when they disconnect, it decreases by one.
Setting the global userstat begins counting new concurrent sessions from that point forward; pre-existing concurrent sessions are not counted until they are restarted. Ideally this configuration is set in the my.cnf file so as to apply from server startup, ensuring that the counter is consistent. If it is set during the server's lifetime (via SET GLOBAL userstat=1) it is recommended to do so before concurrent user sessions exist for accurate counts.