Skip to content

Conversation

DaveGosselin-MariaDB
Copy link
Member

…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.

@DaveGosselin-MariaDB DaveGosselin-MariaDB self-assigned this Sep 4, 2025
@DaveGosselin-MariaDB DaveGosselin-MariaDB force-pushed the 10.11-mdev-23283-concurrent-connection-count branch 4 times, most recently from 5337968 to d0667f9 Compare September 5, 2025 16:17
Copy link
Member

@vuvova vuvova left a 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

@DaveGosselin-MariaDB DaveGosselin-MariaDB force-pushed the 10.11-mdev-23283-concurrent-connection-count branch 2 times, most recently from 3e526fd to 9ff4409 Compare September 8, 2025 17:31
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.
@DaveGosselin-MariaDB DaveGosselin-MariaDB force-pushed the 10.11-mdev-23283-concurrent-connection-count branch 2 times, most recently from 2db9ac9 to a3f3fdf Compare September 9, 2025 18:08
@DaveGosselin-MariaDB DaveGosselin-MariaDB force-pushed the 10.11-mdev-23283-concurrent-connection-count branch 2 times, most recently from cee13cb to 7648f7a Compare September 10, 2025 12:58
# 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
Copy link
Member

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

Copy link
Member Author

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;

@DaveGosselin-MariaDB DaveGosselin-MariaDB force-pushed the 10.11-mdev-23283-concurrent-connection-count branch 2 times, most recently from af84003 to 3487500 Compare September 10, 2025 16:53
@DaveGosselin-MariaDB DaveGosselin-MariaDB merged commit ca168a7 into 10.11 Sep 10, 2025
16 of 17 checks passed
@DaveGosselin-MariaDB DaveGosselin-MariaDB deleted the 10.11-mdev-23283-concurrent-connection-count branch September 10, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants