summaryrefslogtreecommitdiff
path: root/sql/session_tracker.cc
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2019-03-20 01:32:10 +0400
committerSergey Vojtovich <svoj@mariadb.org>2019-05-03 16:46:10 +0400
commit53671a1fff8d4aa0978be2fb916f8e053c09424a (patch)
tree15c669763c7c465bc11f0bc4907aa3a0a6e61d4f /sql/session_tracker.cc
parent1b5cf2f7e7995f8ee17da76eb28633f652852d8f (diff)
downloadmariadb-git-53671a1fff8d4aa0978be2fb916f8e053c09424a.tar.gz
Make connect speed great again
Rather than parsing session_track_system_variables when thread starts, do it when first trackable event occurs. Benchmarked on a 2socket/20core/40threads Broadwell system using sysbench connect brencmark @40 threads (with select 1 disabled): 101379.77 -> 143016.68 CPS, whereas 10.2 is currently at 137766.31 CPS. Part of MDEV-14984 - regression in connect performance
Diffstat (limited to 'sql/session_tracker.cc')
-rw-r--r--sql/session_tracker.cc27
1 files changed, 18 insertions, 9 deletions
diff --git a/sql/session_tracker.cc b/sql/session_tracker.cc
index 8b0e247767c..db82b7dffe9 100644
--- a/sql/session_tracker.cc
+++ b/sql/session_tracker.cc
@@ -379,16 +379,10 @@ void Session_sysvars_tracker::deinit(THD *thd)
bool Session_sysvars_tracker::enable(THD *thd)
{
- LEX_STRING tmp= { thd->variables.session_track_system_variables,
- safe_strlen(thd->variables.session_track_system_variables) };
orig_list.reinit();
- if (orig_list.parse_var_list(thd, tmp, true, thd->charset()) == true)
- {
- orig_list.reinit();
- m_enabled= false;
- return true;
- }
- m_enabled= true;
+ m_parsed= false;
+ m_enabled= thd->variables.session_track_system_variables &&
+ *thd->variables.session_track_system_variables;
return false;
}
@@ -433,6 +427,7 @@ bool Session_sysvars_tracker::update(THD *thd, set_var *var)
my_free(thd->variables.session_track_system_variables);
thd->variables.session_track_system_variables= static_cast<char*>(copy);
+ m_parsed= true;
orig_list.copy(&tool_list, thd);
orig_list.construct_var_list(thd->variables.session_track_system_variables,
var->save_result.string_value.length + 1);
@@ -540,6 +535,20 @@ void Session_sysvars_tracker::mark_as_changed(THD *thd,
{
sysvar_node_st *node;
sys_var *svar= (sys_var *)var;
+
+ if (!m_parsed)
+ {
+ DBUG_ASSERT(thd->variables.session_track_system_variables);
+ LEX_STRING tmp= { thd->variables.session_track_system_variables,
+ strlen(thd->variables.session_track_system_variables) };
+ if (orig_list.parse_var_list(thd, tmp, true, thd->charset()))
+ {
+ orig_list.reinit();
+ return;
+ }
+ m_parsed= true;
+ }
+
/*
Check if the specified system variable is being tracked, if so
mark it as changed and also set the class's m_changed flag.