Description:
The client which uses normal user without super privileges connects to mysql server failed due to `too many connection`. The system global status `Max_used_connections` will show error message.Its value is one more than expected.
How to repeat:
1. Create Normal user `test` which has no super privilege.
2. Set global max_connections= 2
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 2 |
+-----------------+-------+
3. Using three clients which user are `test` to connect to server.
4. The third client will connect failed due to `too many connection`
5. show global status like "Max_used_connections"
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| Max_used_connections | 3 |
+----------------------+-------+
6. The value of `Max_used_connections` is 3. But the value we expected is 2.
Suggested fix:
When the number of connections reaches the the value of `max_connections`.The server will retain a free connection for the user which has super privilege.When the normal user connect to server, the value of status `Max_used_connections` will increment and the connection will fail.
When the connection fails because it has no super privilege, we expect the value of status `Max_used_connections`reducing to correct value.
Or updating the value of status `Max_used_connections` after executing function `acl_authenticate` success instead of function `Connection_handler_manager::check_and_incr_conn_count`.