mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Adieu find_sys_var_ex()
Only take LOCK_plugin for plugin system variables. Reverted optimisation that was originally done for session tracker: it makes much less sense now. Specifically only if connections would want to track plugin session variables changes and these changes would actually happen frequently. If this ever becomes an issue, there're much better ways to optimise this workload. Part of MDEV-14984 - regression in connect performance
This commit is contained in:
@ -2822,37 +2822,25 @@ static void update_func_double(THD *thd, struct st_mysql_sys_var *var,
|
||||
System Variables support
|
||||
****************************************************************************/
|
||||
|
||||
sys_var *find_sys_var_ex(THD *thd, const char *str, size_t length,
|
||||
bool throw_error, bool locked)
|
||||
sys_var *find_sys_var(THD *thd, const char *str, size_t length,
|
||||
bool throw_error)
|
||||
{
|
||||
sys_var *var;
|
||||
sys_var_pluginvar *pi= NULL;
|
||||
plugin_ref plugin;
|
||||
DBUG_ENTER("find_sys_var_ex");
|
||||
sys_var_pluginvar *pi;
|
||||
DBUG_ENTER("find_sys_var");
|
||||
DBUG_PRINT("enter", ("var '%.*s'", (int)length, str));
|
||||
|
||||
if (!locked)
|
||||
mysql_mutex_lock(&LOCK_plugin);
|
||||
mysql_prlock_rdlock(&LOCK_system_variables_hash);
|
||||
if ((var= intern_find_sys_var(str, length)) &&
|
||||
(pi= var->cast_pluginvar()))
|
||||
{
|
||||
mysql_prlock_unlock(&LOCK_system_variables_hash);
|
||||
LEX *lex= thd ? thd->lex : 0;
|
||||
if (!(plugin= intern_plugin_lock(lex, plugin_int_to_ref(pi->plugin))))
|
||||
mysql_mutex_lock(&LOCK_plugin);
|
||||
if (!intern_plugin_lock(thd ? thd->lex : 0, plugin_int_to_ref(pi->plugin),
|
||||
PLUGIN_IS_READY))
|
||||
var= NULL; /* failed to lock it, it must be uninstalling */
|
||||
else
|
||||
if (!(plugin_state(plugin) & PLUGIN_IS_READY))
|
||||
{
|
||||
/* initialization not completed */
|
||||
var= NULL;
|
||||
intern_plugin_unlock(lex, plugin);
|
||||
}
|
||||
}
|
||||
else
|
||||
mysql_prlock_unlock(&LOCK_system_variables_hash);
|
||||
if (!locked)
|
||||
mysql_mutex_unlock(&LOCK_plugin);
|
||||
}
|
||||
mysql_prlock_unlock(&LOCK_system_variables_hash);
|
||||
|
||||
if (unlikely(!throw_error && !var))
|
||||
my_error(ER_UNKNOWN_SYSTEM_VARIABLE, MYF(0),
|
||||
@ -2861,11 +2849,6 @@ sys_var *find_sys_var_ex(THD *thd, const char *str, size_t length,
|
||||
}
|
||||
|
||||
|
||||
sys_var *find_sys_var(THD *thd, const char *str, size_t length)
|
||||
{
|
||||
return find_sys_var_ex(thd, str, length, false, false);
|
||||
}
|
||||
|
||||
/*
|
||||
called by register_var, construct_options and test_plugin_options.
|
||||
Returns the 'bookmark' for the named variable.
|
||||
|
Reference in New Issue
Block a user