Currently in check_user(), we take this mutex: > my_bool opt_secure_auth_local; > pthread_mutex_lock(&LOCK_global_system_variables); > opt_secure_auth_local= opt_secure_auth; > pthread_mutex_unlock(&LOCK_global_system_variables); It would be simpler and faster if we moved opt_secure_auth to global_system_variables, and make opt_secure_auth_local a read-only session variable, because then opt_secure_auth would automatically copied to opt_secure_auth, under mutex, by THD::init(): pthread_mutex_lock(&LOCK_global_system_variables); variables= global_system_variables; <cut> pthread_mutex_unlock(&LOCK_global_system_variables); and then we can remove the copy done in check_user(). We save one mutex lock/unlock per connection at the cost of having the opt_secure_auth_local stored in THD. As a consequence, we would need in fact to do this copy (with mutex) when CHANGE USER. This is a suggestion coming from a discussion between Konstantin and Guilhem Date: Thu, 8 Jul 2004 00:23:40 +0400 From: Konstantin Osipov <konstantin@mysql.com> To: Guilhem Bichot <guilhem@mysql.com> Cc: dev-public@mysql.com Subject: Re: Why do we need LOCK_global_system_variables when testing opt_secure_auth once per connection ?
