@@ -2833,23 +2833,6 @@ static double *mysql_sys_var_double(THD *thd, int offset) {
28332833 return (double *)intern_sys_var_ptr (thd, offset, true );
28342834}
28352835
2836- /*
2837- Initialize variables within THD.
2838-
2839- @param THD Session THD pointer.
2840- */
2841- static void plugin_thd_init_variables (THD *thd) {
2842- mysql_mutex_assert_owner (&LOCK_global_system_variables);
2843-
2844- thd->variables = global_system_variables;
2845- thd->variables .table_plugin = NULL ;
2846- thd->variables .temp_table_plugin = NULL ;
2847-
2848- thd->variables .dynamic_variables_version = 0 ;
2849- thd->variables .dynamic_variables_size = 0 ;
2850- thd->variables .dynamic_variables_ptr = 0 ;
2851- }
2852-
28532836void plugin_thdvar_init (THD *thd, bool enable_plugins) {
28542837 plugin_ref old_table_plugin = thd->variables .table_plugin ;
28552838 plugin_ref old_temp_table_plugin = thd->variables .temp_table_plugin ;
@@ -2859,28 +2842,26 @@ void plugin_thdvar_init(THD *thd, bool enable_plugins) {
28592842 thd->variables .temp_table_plugin = NULL ;
28602843 cleanup_variables (thd, &thd->variables );
28612844
2862- if (!enable_plugins) {
2863- mysql_mutex_lock (&LOCK_global_system_variables);
2845+ mysql_mutex_lock (&LOCK_global_system_variables);
2846+ thd->variables = global_system_variables;
2847+ thd->variables .table_plugin = NULL ;
2848+ thd->variables .temp_table_plugin = NULL ;
28642849
2865- plugin_thd_init_variables (thd);
2850+ thd->variables .dynamic_variables_version = 0 ;
2851+ thd->variables .dynamic_variables_size = 0 ;
2852+ thd->variables .dynamic_variables_ptr = 0 ;
28662853
2867- mysql_mutex_unlock (&LOCK_global_system_variables);
2868- } else {
2854+ if (enable_plugins) {
28692855 mysql_mutex_lock (&LOCK_plugin);
2870- mysql_mutex_lock (&LOCK_global_system_variables);
2871-
2872- plugin_thd_init_variables (thd);
2873-
28742856 thd->variables .table_plugin =
28752857 my_intern_plugin_lock (NULL , global_system_variables.table_plugin );
28762858 intern_plugin_unlock (NULL , old_table_plugin);
28772859 thd->variables .temp_table_plugin =
28782860 my_intern_plugin_lock (NULL , global_system_variables.temp_table_plugin );
28792861 intern_plugin_unlock (NULL , old_temp_table_plugin);
2880-
2881- mysql_mutex_unlock (&LOCK_global_system_variables);
28822862 mysql_mutex_unlock (&LOCK_plugin);
28832863 }
2864+ mysql_mutex_unlock (&LOCK_global_system_variables);
28842865
28852866 /* Initialize all Sys_var_charptr variables here. */
28862867
0 commit comments