summaryrefslogtreecommitdiff
path: root/sql/sql_plugin.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_plugin.cc')
-rw-r--r--sql/sql_plugin.cc212
1 files changed, 131 insertions, 81 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 69702813f08..330d8b668ed 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -28,7 +28,6 @@
#include "sql_table.h"
#include "sql_show.h" // remove_status_vars, add_status_vars
#include "strfunc.h" // find_set
-#include "sql_acl.h" // *_ACL
#include "records.h" // init_read_record, end_read_record
#include <my_pthread.h>
#include <my_getopt.h>
@@ -38,8 +37,16 @@
#include <mysql/plugin_auth.h>
#include <mysql/plugin_password_validation.h>
#include <mysql/plugin_encryption.h>
+#include <mysql/plugin_data_type.h>
+#include <mysql/plugin_function.h>
#include "sql_plugin_compat.h"
+static PSI_memory_key key_memory_plugin_mem_root;
+static PSI_memory_key key_memory_plugin_int_mem_root;
+static PSI_memory_key key_memory_mysql_plugin;
+static PSI_memory_key key_memory_mysql_plugin_dl;
+static PSI_memory_key key_memory_plugin_bookmark;
+
#ifdef HAVE_LINK_H
#include <link.h>
#endif
@@ -90,7 +97,9 @@ const LEX_CSTRING plugin_type_names[MYSQL_MAX_PLUGIN_TYPE_NUM]=
{ STRING_WITH_LEN("REPLICATION") },
{ STRING_WITH_LEN("AUTHENTICATION") },
{ STRING_WITH_LEN("PASSWORD VALIDATION") },
- { STRING_WITH_LEN("ENCRYPTION") }
+ { STRING_WITH_LEN("ENCRYPTION") },
+ { STRING_WITH_LEN("DATA TYPE") },
+ { STRING_WITH_LEN("FUNCTION") }
};
extern int initialize_schema_table(st_plugin_int *plugin);
@@ -102,6 +111,8 @@ extern int finalize_audit_plugin(st_plugin_int *plugin);
extern int initialize_encryption_plugin(st_plugin_int *plugin);
extern int finalize_encryption_plugin(st_plugin_int *plugin);
+extern int initialize_data_type_plugin(st_plugin_int *plugin);
+
/*
The number of elements in both plugin_type_initialize and
plugin_type_deinitialize should equal to the number of plugins
@@ -110,13 +121,15 @@ extern int finalize_encryption_plugin(st_plugin_int *plugin);
plugin_type_init plugin_type_initialize[MYSQL_MAX_PLUGIN_TYPE_NUM]=
{
0, ha_initialize_handlerton, 0, 0,initialize_schema_table,
- initialize_audit_plugin, 0, 0, 0, initialize_encryption_plugin
+ initialize_audit_plugin, 0, 0, 0, initialize_encryption_plugin,
+ initialize_data_type_plugin, 0
};
plugin_type_init plugin_type_deinitialize[MYSQL_MAX_PLUGIN_TYPE_NUM]=
{
0, ha_finalize_handlerton, 0, 0, finalize_schema_table,
- finalize_audit_plugin, 0, 0, 0, finalize_encryption_plugin
+ finalize_audit_plugin, 0, 0, 0, finalize_encryption_plugin, 0,
+ 0 // FUNCTION
};
/*
@@ -128,6 +141,8 @@ static int plugin_type_initialization_order[MYSQL_MAX_PLUGIN_TYPE_NUM]=
{
MYSQL_DAEMON_PLUGIN,
MariaDB_ENCRYPTION_PLUGIN,
+ MariaDB_DATA_TYPE_PLUGIN,
+ MariaDB_FUNCTION_PLUGIN,
MYSQL_STORAGE_ENGINE_PLUGIN,
MYSQL_INFORMATION_SCHEMA_PLUGIN,
MYSQL_FTPARSER_PLUGIN,
@@ -169,7 +184,9 @@ static int min_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]=
MYSQL_REPLICATION_INTERFACE_VERSION,
MIN_AUTHENTICATION_INTERFACE_VERSION,
MariaDB_PASSWORD_VALIDATION_INTERFACE_VERSION,
- MariaDB_ENCRYPTION_INTERFACE_VERSION
+ MariaDB_ENCRYPTION_INTERFACE_VERSION,
+ MariaDB_DATA_TYPE_INTERFACE_VERSION,
+ MariaDB_FUNCTION_INTERFACE_VERSION
};
static int cur_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]=
{
@@ -182,7 +199,9 @@ static int cur_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]=
MYSQL_REPLICATION_INTERFACE_VERSION,
MYSQL_AUTHENTICATION_INTERFACE_VERSION,
MariaDB_PASSWORD_VALIDATION_INTERFACE_VERSION,
- MariaDB_ENCRYPTION_INTERFACE_VERSION
+ MariaDB_ENCRYPTION_INTERFACE_VERSION,
+ MariaDB_DATA_TYPE_INTERFACE_VERSION,
+ MariaDB_FUNCTION_INTERFACE_VERSION
};
static struct
@@ -440,9 +459,8 @@ static struct st_plugin_dl *plugin_dl_find(const LEX_CSTRING *dl)
{
tmp= *dynamic_element(&plugin_dl_array, i, struct st_plugin_dl **);
if (tmp->ref_count &&
- ! my_strnncoll(files_charset_info,
- (const uchar *)dl->str, dl->length,
- (const uchar *)tmp->dl.str, tmp->dl.length))
+ ! files_charset_info->strnncoll(dl->str, dl->length,
+ tmp->dl.str, tmp->dl.length))
DBUG_RETURN(tmp);
}
DBUG_RETURN(0);
@@ -560,7 +578,7 @@ static my_bool read_mysql_plugin_info(struct st_plugin_dl *plugin_dl,
/* no op */;
cur= (struct st_maria_plugin*)
- my_malloc((i + 1) * sizeof(struct st_maria_plugin),
+ my_malloc(key_memory_mysql_plugin, (i + 1) * sizeof(struct st_maria_plugin),
MYF(MY_ZEROFILL|MY_WME));
if (!cur)
{
@@ -680,7 +698,7 @@ static my_bool read_maria_plugin_info(struct st_plugin_dl *plugin_dl,
/* no op */;
cur= (struct st_maria_plugin*)
- my_malloc((i + 1) * sizeof(struct st_maria_plugin),
+ my_malloc(key_memory_mysql_plugin, (i + 1) * sizeof(struct st_maria_plugin),
MYF(MY_ZEROFILL|MY_WME));
if (!cur)
{
@@ -805,7 +823,8 @@ static st_plugin_dl *plugin_dl_add(const LEX_CSTRING *dl, myf MyFlags)
if (plugin_dl.nbackups)
{
size_t bytes= plugin_dl.nbackups * sizeof(plugin_dl.ptr_backup[0]);
- plugin_dl.ptr_backup= (st_ptr_backup *)my_malloc(bytes, MYF(0));
+ plugin_dl.ptr_backup= (st_ptr_backup *)my_malloc(key_memory_mysql_plugin_dl,
+ bytes, MYF(0));
if (!plugin_dl.ptr_backup)
{
restore_ptr_backup(plugin_dl.nbackups, tmp_backup);
@@ -817,7 +836,8 @@ static st_plugin_dl *plugin_dl_add(const LEX_CSTRING *dl, myf MyFlags)
/* Duplicate and convert dll name */
plugin_dl.dl.length= dl->length * files_charset_info->mbmaxlen + 1;
- if (! (plugin_dl.dl.str= (char*) my_malloc(plugin_dl.dl.length, MYF(0))))
+ if (! (plugin_dl.dl.str= (char*) my_malloc(key_memory_mysql_plugin_dl,
+ plugin_dl.dl.length, MYF(0))))
{
my_error(ER_OUTOFMEMORY, MyFlags,
static_cast<int>(plugin_dl.dl.length));
@@ -964,7 +984,8 @@ static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc,
memory manager and/or valgrind to track locked references and
double unlocks to aid resolving reference counting problems.
*/
- if (!(plugin= (plugin_ref) my_malloc(sizeof(pi), MYF(MY_WME))))
+ if (!(plugin= (plugin_ref) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(pi),
+ MYF(MY_WME))))
DBUG_RETURN(NULL);
*plugin= pi;
@@ -1114,9 +1135,8 @@ static enum install_status plugin_add(MEM_ROOT *tmp_root, bool if_not_exists,
tmp.plugin_dl->mariaversion == 0))
continue; // unsupported plugin type
- if (name->str && my_strnncoll(system_charset_info,
- (const uchar *)name->str, name->length,
- (const uchar *)tmp.name.str, tmp.name.length))
+ if (name->str && system_charset_info->strnncoll(name->str, name->length,
+ tmp.name.str, tmp.name.length))
continue; // plugin name doesn't match
if (!name->str &&
@@ -1174,7 +1194,8 @@ static enum install_status plugin_add(MEM_ROOT *tmp_root, bool if_not_exists,
goto err;
if (my_hash_insert(&plugin_hash[plugin->type], (uchar*)tmp_plugin_ptr))
tmp_plugin_ptr->state= PLUGIN_IS_FREED;
- init_alloc_root(&tmp_plugin_ptr->mem_root, "plugin", 4096, 4096, MYF(0));
+ init_alloc_root(key_memory_plugin_int_mem_root, &tmp_plugin_ptr->mem_root,
+ 4096, 4096, MYF(0));
if (name->str)
DBUG_RETURN(INSTALL_GOOD); // all done
@@ -1529,6 +1550,15 @@ static PSI_mutex_info all_plugin_mutexes[]=
{ &key_LOCK_plugin, "LOCK_plugin", PSI_FLAG_GLOBAL}
};
+static PSI_memory_info all_plugin_memory[]=
+{
+ { &key_memory_plugin_mem_root, "plugin_mem_root", PSI_FLAG_GLOBAL},
+ { &key_memory_plugin_int_mem_root, "plugin_int_mem_root", 0},
+ { &key_memory_mysql_plugin_dl, "mysql_plugin_dl", 0},
+ { &key_memory_mysql_plugin, "mysql_plugin", 0},
+ { &key_memory_plugin_bookmark, "plugin_bookmark", PSI_FLAG_GLOBAL}
+};
+
static void init_plugin_psi_keys(void)
{
const char* category= "sql";
@@ -1539,7 +1569,12 @@ static void init_plugin_psi_keys(void)
count= array_elements(all_plugin_mutexes);
PSI_server->register_mutex(category, all_plugin_mutexes, count);
+
+ count= array_elements(all_plugin_memory);
+ mysql_memory_register(category, all_plugin_memory, count);
}
+#else
+static void init_plugin_psi_keys(void) {}
#endif /* HAVE_PSI_INTERFACE */
/*
@@ -1558,6 +1593,9 @@ int plugin_init(int *argc, char **argv, int flags)
MEM_ROOT tmp_root;
bool reaped_mandatory_plugin= false;
bool mandatory= true;
+ I_List_iterator<i_string> opt_plugin_load_list_iter(opt_plugin_load_list);
+ char plugin_table_engine_name_buf[NAME_CHAR_LEN + 1];
+ LEX_CSTRING plugin_table_engine_name= { plugin_table_engine_name_buf, 0 };
LEX_CSTRING MyISAM= { STRING_WITH_LEN("MyISAM") };
DBUG_ENTER("plugin_init");
@@ -1566,11 +1604,13 @@ int plugin_init(int *argc, char **argv, int flags)
dlopen_count =0;
- init_alloc_root(&plugin_mem_root, "plugin", 4096, 4096, MYF(0));
- init_alloc_root(&plugin_vars_mem_root, "plugin_vars", 4096, 4096, MYF(0));
- init_alloc_root(&tmp_root, "plugin_tmp", 4096, 4096, MYF(0));
+ init_plugin_psi_keys();
+
+ init_alloc_root(key_memory_plugin_mem_root, &plugin_mem_root, 4096, 4096, MYF(0));
+ init_alloc_root(key_memory_plugin_mem_root, &plugin_vars_mem_root, 4096, 4096, MYF(0));
+ init_alloc_root(PSI_NOT_INSTRUMENTED, &tmp_root, 4096, 4096, MYF(0));
- if (my_hash_init(&bookmark_hash, &my_charset_bin, 32, 0, 0,
+ if (my_hash_init(key_memory_plugin_bookmark, &bookmark_hash, &my_charset_bin, 32, 0, 0,
get_bookmark_hash_key, NULL, HASH_UNIQUE))
goto err;
@@ -1578,15 +1618,15 @@ int plugin_init(int *argc, char **argv, int flags)
The 80 is from 2016-04-27 when we had 71 default plugins
Big enough to avoid many mallocs even in future
*/
- if (my_init_dynamic_array(&plugin_dl_array,
+ if (my_init_dynamic_array(key_memory_mysql_plugin_dl, &plugin_dl_array,
sizeof(struct st_plugin_dl *), 16, 16, MYF(0)) ||
- my_init_dynamic_array(&plugin_array,
+ my_init_dynamic_array(key_memory_mysql_plugin, &plugin_array,
sizeof(struct st_plugin_int *), 80, 32, MYF(0)))
goto err;
for (i= 0; i < MYSQL_MAX_PLUGIN_TYPE_NUM; i++)
{
- if (my_hash_init(&plugin_hash[i], system_charset_info, 32, 0, 0,
+ if (my_hash_init(key_memory_plugin_mem_root, &plugin_hash[i], system_charset_info, 32, 0, 0,
get_plugin_hash_key, NULL, HASH_UNIQUE))
goto err;
}
@@ -1620,8 +1660,7 @@ int plugin_init(int *argc, char **argv, int flags)
for (plugin= *builtins; plugin->info; plugin++)
{
if (opt_ignore_builtin_innodb &&
- !my_strnncoll(&my_charset_latin1, (const uchar*) plugin->name,
- 6, (const uchar*) "InnoDB", 6))
+ !my_charset_latin1.strnncoll(plugin->name, 6, "InnoDB", 6))
continue;
bzero(&tmp, sizeof(tmp));
@@ -1668,35 +1707,22 @@ int plugin_init(int *argc, char **argv, int flags)
global_system_variables.table_plugin =
intern_plugin_lock(NULL, plugin_int_to_ref(plugin_ptr));
DBUG_SLOW_ASSERT(plugin_ptr->ref_count == 1);
-
}
mysql_mutex_unlock(&LOCK_plugin);
/* Register (not initialize!) all dynamic plugins */
- if (!(flags & PLUGIN_INIT_SKIP_DYNAMIC_LOADING))
+ if (global_system_variables.log_warnings >= 9)
+ sql_print_information("Initializing plugins specified on the command line");
+ while (i_string *item= opt_plugin_load_list_iter++)
+ plugin_load_list(&tmp_root, item->ptr);
+
+ if (!(flags & PLUGIN_INIT_SKIP_PLUGIN_TABLE))
{
- I_List_iterator<i_string> iter(opt_plugin_load_list);
- i_string *item;
- if (global_system_variables.log_warnings >= 9)
- sql_print_information("Initializing plugins specified on the command line");
- while (NULL != (item= iter++))
- plugin_load_list(&tmp_root, item->ptr);
-
- if (!(flags & PLUGIN_INIT_SKIP_PLUGIN_TABLE))
- {
- char path[FN_REFLEN + 1];
- build_table_filename(path, sizeof(path) - 1, "mysql", "plugin", reg_ext, 0);
- char engine_name_buf[NAME_CHAR_LEN + 1];
- LEX_CSTRING maybe_myisam= { engine_name_buf, 0 };
- bool is_sequence;
- Table_type frm_type= dd_frm_type(NULL, path, &maybe_myisam, &is_sequence);
- /* if mysql.plugin table is MyISAM - load it right away */
- if (frm_type == TABLE_TYPE_NORMAL && !strcasecmp(maybe_myisam.str, "MyISAM"))
- {
- plugin_load(&tmp_root);
- flags|= PLUGIN_INIT_SKIP_PLUGIN_TABLE;
- }
- }
+ char path[FN_REFLEN + 1];
+ build_table_filename(path, sizeof(path) - 1, "mysql", "plugin", reg_ext, 0);
+ Table_type ttype= dd_frm_type(0, path, &plugin_table_engine_name);
+ if (ttype != TABLE_TYPE_NORMAL)
+ plugin_table_engine_name=empty_clex_str;
}
/*
@@ -1717,8 +1743,12 @@ int plugin_init(int *argc, char **argv, int flags)
plugin_ptr= (struct st_plugin_int *) my_hash_element(hash, idx);
if (plugin_ptr->state == PLUGIN_IS_UNINITIALIZED)
{
- if (plugin_initialize(&tmp_root, plugin_ptr, argc, argv,
- (flags & PLUGIN_INIT_SKIP_INITIALIZATION)))
+ bool plugin_table_engine= lex_string_eq(&plugin_table_engine_name,
+ &plugin_ptr->name);
+ bool opts_only= flags & PLUGIN_INIT_SKIP_INITIALIZATION &&
+ (flags & PLUGIN_INIT_SKIP_PLUGIN_TABLE ||
+ !plugin_table_engine);
+ if (plugin_initialize(&tmp_root, plugin_ptr, argc, argv, opts_only))
{
plugin_ptr->state= PLUGIN_IS_DYING;
*(reap++)= plugin_ptr;
@@ -1752,7 +1782,7 @@ int plugin_init(int *argc, char **argv, int flags)
mysql_mutex_unlock(&LOCK_plugin);
my_afree(reap);
- if (reaped_mandatory_plugin)
+ if (reaped_mandatory_plugin && !opt_help)
goto err;
free_root(&tmp_root, MYF(0));
@@ -1822,11 +1852,13 @@ static void plugin_load(MEM_ROOT *tmp_root)
{
DBUG_PRINT("error",("Can't open plugin table"));
if (!opt_help)
- sql_print_error("Could not open mysql.plugin table. "
- "Some plugins may be not loaded");
+ sql_print_error("Could not open mysql.plugin table: \"%s\". "
+ "Some plugins may be not loaded",
+ new_thd->get_stmt_da()->message());
else
- sql_print_warning("Could not open mysql.plugin table. "
- "Some options may be missing from the help text");
+ sql_print_warning("Could not open mysql.plugin table: \"%s\". "
+ "Some options may be missing from the help text",
+ new_thd->get_stmt_da()->message());
goto end;
}
@@ -2159,14 +2191,13 @@ static bool finalize_install(THD *thd, TABLE *table, const LEX_CSTRING *name,
of the insert into the plugin table, so that it is not replicated in
row based mode.
*/
- tmp_disable_binlog(thd);
+ DBUG_ASSERT(!table->file->row_logging);
table->use_all_columns();
restore_record(table, s->default_values);
table->field[0]->store(name->str, name->length, system_charset_info);
table->field[1]->store(tmp->plugin_dl->dl.str, tmp->plugin_dl->dl.length,
files_charset_info);
error= table->file->ha_write_row(table->record[0]);
- reenable_binlog(thd);
if (unlikely(error))
{
table->file->print_error(error, MYF(0));
@@ -2230,6 +2261,7 @@ bool mysql_install_plugin(THD *thd, const LEX_CSTRING *name,
mysql_audit_acquire_plugins(thd, event_class_mask);
mysql_mutex_lock(&LOCK_plugin);
+ DEBUG_SYNC(thd, "acquired_LOCK_plugin");
error= plugin_add(thd->mem_root, thd->lex->create_info.if_not_exists(),
name, &dl, MYF(0));
if (unlikely(error != INSTALL_GOOD))
@@ -2315,9 +2347,8 @@ static bool do_uninstall(THD *thd, TABLE *table, const LEX_CSTRING *name)
of the delete from the plugin table, so that it is not replicated in
row based mode.
*/
- tmp_disable_binlog(thd);
+ table->file->row_logging= 0; // No logging
error= table->file->ha_delete_row(table->record[0]);
- reenable_binlog(thd);
if (unlikely(error))
{
table->file->print_error(error, MYF(0));
@@ -2857,7 +2888,8 @@ static void update_func_str(THD *thd, struct st_mysql_sys_var *var,
{
char *old= *(char**) tgt;
if (value)
- *(char**) tgt= my_strdup(value, MYF(0));
+ *(char**) tgt= my_strdup(key_memory_global_system_variables,
+ value, MYF(0));
else
*(char**) tgt= 0;
my_free(old);
@@ -3001,10 +3033,12 @@ static st_bookmark *register_var(const char *plugin, const char *name,
if (new_size > global_variables_dynamic_size)
{
global_system_variables.dynamic_variables_ptr= (char*)
- my_realloc(global_system_variables.dynamic_variables_ptr, new_size,
+ my_realloc(key_memory_global_system_variables,
+ global_system_variables.dynamic_variables_ptr, new_size,
MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
max_system_variables.dynamic_variables_ptr= (char*)
- my_realloc(max_system_variables.dynamic_variables_ptr, new_size,
+ my_realloc(key_memory_global_system_variables,
+ max_system_variables.dynamic_variables_ptr, new_size,
MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
/*
Clear the new variable value space. This is required for string
@@ -3046,7 +3080,8 @@ void sync_dynamic_session_variables(THD* thd, bool global_lock)
uint idx;
thd->variables.dynamic_variables_ptr= (char*)
- my_realloc(thd->variables.dynamic_variables_ptr,
+ my_realloc(key_memory_THD_variables,
+ thd->variables.dynamic_variables_ptr,
global_variables_dynamic_size,
MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
@@ -3080,7 +3115,7 @@ void sync_dynamic_session_variables(THD* thd, bool global_lock)
{
char **pp= (char**) (thd->variables.dynamic_variables_ptr + v->offset);
if (*pp)
- *pp= my_strdup(*pp, MYF(MY_WME|MY_FAE));
+ *pp= my_strdup(key_memory_THD_variables, *pp, MYF(MY_WME|MY_FAE));
}
}
@@ -3935,7 +3970,7 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
(opt->flags & PLUGIN_VAR_MEMALLOC))
{
char *def_val= *(char**)var_def_ptr(opt);
- *(char**)val= def_val ? my_strdup(def_val, MYF(0)) : NULL;
+ *(char**)val= def_val ? my_strdup(PSI_INSTRUMENT_ME, def_val, MYF(0)) : NULL;
}
else
memcpy(val, var_def_ptr(opt), var_storage_size(opt->flags));
@@ -4006,13 +4041,21 @@ static my_option *construct_help_options(MEM_ROOT *mem_root,
DBUG_RETURN(opts);
}
-extern "C" my_bool mark_changed(int, const struct my_option *, char *);
-my_bool mark_changed(int, const struct my_option *opt, char *)
+extern "C" my_bool mark_changed(const struct my_option *, const char *,
+ const char *);
+my_bool mark_changed(const struct my_option *opt, const char *,
+ const char *filename)
{
if (opt->app_type)
{
sys_var *var= (sys_var*) opt->app_type;
- var->value_origin= sys_var::CONFIG;
+ if (*filename)
+ {
+ var->origin_filename= filename;
+ var->value_origin= sys_var::CONFIG;
+ }
+ else
+ var->value_origin= sys_var::COMMAND_LINE;
}
return 0;
}
@@ -4177,7 +4220,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
*/
if (disable_plugin)
{
- if (global_system_variables.log_warnings)
+ if (global_system_variables.log_warnings && !opt_help)
sql_print_information("Plugin '%s' is disabled.",
tmp->name.str);
goto err;
@@ -4185,7 +4228,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
if (tmp->plugin->system_vars)
{
- for (opt= tmp->plugin->system_vars; *opt; opt++)
+ if (mysqld_server_started)
{
/*
PLUGIN_VAR_STR command-line options without PLUGIN_VAR_MEMALLOC, point
@@ -4198,13 +4241,22 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
Thus, for all plugins loaded after the server was started,
we copy string values to a plugin's memroot.
*/
- if (mysqld_server_started &&
- (((*opt)->flags & (PLUGIN_VAR_TYPEMASK | PLUGIN_VAR_NOCMDOPT |
- PLUGIN_VAR_MEMALLOC)) == PLUGIN_VAR_STR))
+ for (opt= tmp->plugin->system_vars; *opt; opt++)
{
- sysvar_str_t* str= (sysvar_str_t *)*opt;
- if (*str->value)
- *str->value= strdup_root(mem_root, *str->value);
+ if ((((*opt)->flags & (PLUGIN_VAR_TYPEMASK | PLUGIN_VAR_NOCMDOPT |
+ PLUGIN_VAR_MEMALLOC)) == PLUGIN_VAR_STR))
+ {
+ sysvar_str_t* str= (sysvar_str_t *)*opt;
+ if (*str->value)
+ *str->value= strdup_root(mem_root, *str->value);
+ }
+ }
+ /* same issue with config file names */
+ for (my_option *mo=opts; mo->name; mo++)
+ {
+ sys_var *var= (sys_var*) mo->app_type;
+ if (var && var->value_origin == sys_var::CONFIG)
+ var->origin_filename= strdup_root(mem_root, var->origin_filename);
}
}
@@ -4357,9 +4409,7 @@ int thd_setspecific(MYSQL_THD thd, MYSQL_THD_KEY_T key, void *value)
void plugin_mutex_init()
{
-#ifdef HAVE_PSI_INTERFACE
init_plugin_psi_keys();
-#endif
mysql_mutex_init(key_LOCK_plugin, &LOCK_plugin, MY_MUTEX_INIT_FAST);
}