Loops against all user connections and resets stats.
User statistics in facebook mysql is a part of user resources, thus it's not working in the same way as in original google patches or percona/mariadb, e.g. number of concurrent connections obtained from user resources.
But anyway both google and facebook implementations looping. So I can:
- loop accross all hash items (my_hash_element for(0;<global_user_stats.records))
- my_hash_delete item if concurrent_connections == 0
- cut user_stats values from init_user_stats to separate reset_user_stats function (it could be possible to use init_user_stats to reset values, but it uses strncpy(user_stats->user, user, sizeof(user_stats->user)); and if user_stats->user will be the same pointer as user it should be UB, because strncpy defined with restrict: extern char *strncpy (char *__restrict __dest, const char *__restrict __src, size_t __n) ) or allow to have init_user_stats user=NULL and do not use strncpy if user parameter is null to re-init already existing user stats.
https:/ /github. com/facebook/ mysql-5. 6.git
reload_ acl_and_ cache => if (options & REFRESH_STATISTICS) => reset_global_ user_stats https:/ /github. com/facebook/ mysql-5. 6/blob/ 9cbb76e8505ee34 3b91de537a8212e 8a384cec9b/ sql/sql_ connect. cc#L1234
Loops against all user connections and resets stats.
User statistics in facebook mysql is a part of user resources, thus it's not working in the same way as in original google patches or percona/mariadb, e.g. number of concurrent connections obtained from user resources.
But anyway both google and facebook implementations looping. So I can: global_ user_stats. records) ) connections == 0 user_stats- >user, user, sizeof( user_stats- >user)) ; and if user_stats->user will be the same pointer as user it should be UB, because strncpy defined with restrict: extern char *strncpy (char *__restrict __dest, const char *__restrict __src, size_t __n) ) or allow to have init_user_stats user=NULL and do not use strncpy if user parameter is null to re-init already existing user stats.
- loop accross all hash items (my_hash_element for(0;<
- my_hash_delete item if concurrent_
- cut user_stats values from init_user_stats to separate reset_user_stats function (it could be possible to use init_user_stats to reset values, but it uses strncpy(