[Commits] 07ed346ebda: Optimize charset tracking a bit.
revision-id: 07ed346ebdad6c661682d46ec21f2f09d439573d (mariadb-10.2.15-70-g07ed346ebda) parent(s): 943e0b77d567141963b17d1c83b4e5692c46ebc4 author: Oleksandr Byelkin committer: Oleksandr Byelkin timestamp: 2018-06-19 18:27:26 +0200 message: Optimize charset tracking a bit. --- sql/set_var.cc | 24 ++++++------------------ sql/set_var.h | 4 +++- sql/sys_vars.cc | 6 ++++++ 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/sql/set_var.cc b/sql/set_var.cc index e96e636e3d3..d27751b8ab7 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1004,24 +1004,12 @@ int set_var_collation_client::update(THD *thd) #ifndef EMBEDDED_LIBRARY if (thd->session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)->is_enabled()) { - sys_var *svar; - mysql_mutex_lock(&LOCK_plugin); - if ((svar= find_sys_var_ex(thd, "character_set_client", - sizeof("character_set_client") - 1, - false, true))) - thd->session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)-> - mark_as_changed(thd, (LEX_CSTRING*)svar); - if ((svar= find_sys_var_ex(thd, "character_set_results", - sizeof("character_set_results") - 1, - false, true))) - thd->session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)-> - mark_as_changed(thd, (LEX_CSTRING*)svar); - if ((svar= find_sys_var_ex(thd, "character_set_connection", - sizeof("character_set_connection") - 1, - false, true))) - thd->session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)-> - mark_as_changed(thd, (LEX_CSTRING*)svar); - mysql_mutex_unlock(&LOCK_plugin); + thd->session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)-> + mark_as_changed(thd, (LEX_CSTRING*)Sys_character_set_client_ptr); + thd->session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)-> + mark_as_changed(thd, (LEX_CSTRING*)Sys_character_set_results_ptr); + thd->session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)-> + mark_as_changed(thd, (LEX_CSTRING*)Sys_character_set_connection_ptr); } thd->session_tracker.mark_as_changed(thd, SESSION_STATE_CHANGE_TRACKER, NULL); #endif //EMBEDDED_LIBRARY diff --git a/sql/set_var.h b/sql/set_var.h index 24e25af2245..1023bd18078 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -424,7 +424,9 @@ sql_mode_t expand_sql_mode(sql_mode_t sql_mode); bool sql_mode_string_representation(THD *thd, sql_mode_t sql_mode, LEX_STRING *ls); int default_regex_flags_pcre(const THD *thd); -extern sys_var *Sys_autocommit_ptr, *Sys_last_gtid_ptr; +extern sys_var *Sys_autocommit_ptr, *Sys_last_gtid_ptr, + *Sys_character_set_client_ptr, *Sys_character_set_connection_ptr, + *Sys_character_set_results_ptr; CHARSET_INFO *get_old_charset_by_name(const char *old_name); diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 1fd75cb5040..2af4a0922be 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -673,6 +673,8 @@ static Sys_var_struct Sys_character_set_client( offsetof(CHARSET_INFO, csname), DEFAULT(&default_charset_info), NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_cs_client), ON_UPDATE(fix_thd_charset)); +// for check changing +export sys_var *Sys_character_set_client_ptr= &Sys_character_set_client; static Sys_var_struct Sys_character_set_connection( "character_set_connection", "The character set used for " @@ -682,6 +684,8 @@ static Sys_var_struct Sys_character_set_connection( offsetof(CHARSET_INFO, csname), DEFAULT(&default_charset_info), NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(check_charset_not_null), ON_UPDATE(fix_thd_charset)); +// for check changing +export sys_var *Sys_character_set_connection_ptr= &Sys_character_set_connection; static Sys_var_struct Sys_character_set_results( "character_set_results", "The character set used for returning " @@ -689,6 +693,8 @@ static Sys_var_struct Sys_character_set_results( SESSION_VAR(character_set_results), NO_CMD_LINE, offsetof(CHARSET_INFO, csname), DEFAULT(&default_charset_info), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_charset)); +// for check changing +export sys_var *Sys_character_set_results_ptr= &Sys_character_set_results; static Sys_var_struct Sys_character_set_filesystem( "character_set_filesystem", "The filesystem character set",
participants (1)
-
Oleksandr Byelkin