summaryrefslogtreecommitdiff
path: root/sql/session_tracker.cc
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2019-03-21 00:42:48 +0400
committerSergey Vojtovich <svoj@mariadb.org>2019-05-03 16:46:11 +0400
commit894df7edb67b888c41eae5ffbe654ceba97c6b8f (patch)
treef5d1e9d5fb1c33e0027dd94260361429395c23e4 /sql/session_tracker.cc
parent53671a1fff8d4aa0978be2fb916f8e053c09424a (diff)
downloadmariadb-git-894df7edb67b888c41eae5ffbe654ceba97c6b8f.tar.gz
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
Diffstat (limited to 'sql/session_tracker.cc')
-rw-r--r--sql/session_tracker.cc38
1 files changed, 4 insertions, 34 deletions
diff --git a/sql/session_tracker.cc b/sql/session_tracker.cc
index db82b7dffe9..63a6770f7d1 100644
--- a/sql/session_tracker.cc
+++ b/sql/session_tracker.cc
@@ -135,13 +135,6 @@ bool Session_sysvars_tracker::vars_list::parse_var_list(THD *thd,
token= var_list.str;
track_all= false;
- /*
- If Lock to the plugin mutex is not acquired here itself, it results
- in having to acquire it multiple times in find_sys_var_ex for each
- token value. Hence the mutex is handled here to avoid a performance
- overhead.
- */
- mysql_mutex_lock(&LOCK_plugin);
for (;;)
{
sys_var *svar;
@@ -165,11 +158,10 @@ bool Session_sysvars_tracker::vars_list::parse_var_list(THD *thd,
{
track_all= true;
}
- else if ((svar=
- find_sys_var_ex(thd, var.str, var.length, throw_error, true)))
+ else if ((svar= find_sys_var(thd, var.str, var.length, throw_error)))
{
if (insert(svar) == TRUE)
- goto error;
+ return true;
}
else if (throw_error && thd)
{
@@ -179,20 +171,14 @@ bool Session_sysvars_tracker::vars_list::parse_var_list(THD *thd,
"be ignored.", (int)var.length, token);
}
else
- goto error;
+ return true;
if (lasts)
token= lasts + 1;
else
break;
}
- mysql_mutex_unlock(&LOCK_plugin);
-
return false;
-
-error:
- mysql_mutex_unlock(&LOCK_plugin);
- return true;
}
@@ -211,14 +197,6 @@ bool sysvartrack_validate_value(THD *thd, const char *str, size_t len)
token= var_list.str;
- /*
- If Lock to the plugin mutex is not acquired here itself, it results
- in having to acquire it multiple times in find_sys_var_ex for each
- token value. Hence the mutex is handled here to avoid a performance
- overhead.
- */
- if (!thd)
- mysql_mutex_lock(&LOCK_plugin);
for (;;)
{
LEX_CSTRING var;
@@ -237,22 +215,14 @@ bool sysvartrack_validate_value(THD *thd, const char *str, size_t len)
/* Remove leading/trailing whitespace. */
trim_whitespace(system_charset_info, &var);
- if(!strcmp(var.str, "*") &&
- !find_sys_var_ex(thd, var.str, var.length, false, true))
- {
- if (!thd)
- mysql_mutex_unlock(&LOCK_plugin);
+ if (!strcmp(var.str, "*") && !find_sys_var(thd, var.str, var.length))
return true;
- }
if (lasts)
token= lasts + 1;
else
break;
}
- if (!thd)
- mysql_mutex_unlock(&LOCK_plugin);
-
return false;
}