cleanup: report_error() in sql_plugin.cc
it's redundant. remove it, use my_error() directly.
This commit is contained in:
parent
3a7d7e180a
commit
d5db2f1084
@ -40,9 +40,6 @@
|
|||||||
#include <mysql/plugin_encryption.h>
|
#include <mysql/plugin_encryption.h>
|
||||||
#include "sql_plugin_compat.h"
|
#include "sql_plugin_compat.h"
|
||||||
|
|
||||||
#define REPORT_TO_LOG 1
|
|
||||||
#define REPORT_TO_USER 2
|
|
||||||
|
|
||||||
#ifdef HAVE_LINK_H
|
#ifdef HAVE_LINK_H
|
||||||
#include <link.h>
|
#include <link.h>
|
||||||
#endif
|
#endif
|
||||||
@ -333,24 +330,6 @@ bool plugin_is_forced(struct st_plugin_int *p)
|
|||||||
p->load_option == PLUGIN_FORCE_PLUS_PERMANENT;
|
p->load_option == PLUGIN_FORCE_PLUS_PERMANENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void report_error(int where_to, uint error, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
DBUG_ASSERT(where_to & (REPORT_TO_USER | REPORT_TO_LOG));
|
|
||||||
if (where_to & REPORT_TO_USER)
|
|
||||||
{
|
|
||||||
va_start(args, error);
|
|
||||||
my_printv_error(error, ER(error), MYF(0), args);
|
|
||||||
va_end(args);
|
|
||||||
}
|
|
||||||
if (where_to & REPORT_TO_LOG)
|
|
||||||
{
|
|
||||||
va_start(args, error);
|
|
||||||
error_log_print(ERROR_LEVEL, ER_DEFAULT(error), args);
|
|
||||||
va_end(args);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check if the provided path is valid in the sense that it does cause
|
Check if the provided path is valid in the sense that it does cause
|
||||||
a relative reference outside the directory.
|
a relative reference outside the directory.
|
||||||
@ -523,7 +502,7 @@ static void free_plugin_mem(struct st_plugin_dl *p)
|
|||||||
@param plugin_dl Structure where the data should be put
|
@param plugin_dl Structure where the data should be put
|
||||||
@param sym Reverence on version info
|
@param sym Reverence on version info
|
||||||
@param dlpath Path to the module
|
@param dlpath Path to the module
|
||||||
@param report What errors should be reported
|
@param MyFlags Where errors should be reported (0 or ME_ERROR_LOG)
|
||||||
|
|
||||||
@retval FALSE OK
|
@retval FALSE OK
|
||||||
@retval TRUE ERROR
|
@retval TRUE ERROR
|
||||||
@ -531,14 +510,13 @@ static void free_plugin_mem(struct st_plugin_dl *p)
|
|||||||
|
|
||||||
#ifdef HAVE_DLOPEN
|
#ifdef HAVE_DLOPEN
|
||||||
static my_bool read_mysql_plugin_info(struct st_plugin_dl *plugin_dl,
|
static my_bool read_mysql_plugin_info(struct st_plugin_dl *plugin_dl,
|
||||||
void *sym, char *dlpath,
|
void *sym, char *dlpath, myf MyFlags)
|
||||||
int report)
|
|
||||||
{
|
{
|
||||||
DBUG_ENTER("read_maria_plugin_info");
|
DBUG_ENTER("read_maria_plugin_info");
|
||||||
/* Determine interface version */
|
/* Determine interface version */
|
||||||
if (!sym)
|
if (!sym)
|
||||||
{
|
{
|
||||||
report_error(report, ER_CANT_FIND_DL_ENTRY, plugin_interface_version_sym);
|
my_error(ER_CANT_FIND_DL_ENTRY, MyFlags, plugin_interface_version_sym);
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
plugin_dl->mariaversion= 0;
|
plugin_dl->mariaversion= 0;
|
||||||
@ -547,14 +525,14 @@ static my_bool read_mysql_plugin_info(struct st_plugin_dl *plugin_dl,
|
|||||||
if (plugin_dl->mysqlversion < min_plugin_interface_version ||
|
if (plugin_dl->mysqlversion < min_plugin_interface_version ||
|
||||||
(plugin_dl->mysqlversion >> 8) > (MYSQL_PLUGIN_INTERFACE_VERSION >> 8))
|
(plugin_dl->mysqlversion >> 8) > (MYSQL_PLUGIN_INTERFACE_VERSION >> 8))
|
||||||
{
|
{
|
||||||
report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, ENOEXEC,
|
my_error(ER_CANT_OPEN_LIBRARY, MyFlags, dlpath, ENOEXEC,
|
||||||
"plugin interface version mismatch");
|
"plugin interface version mismatch");
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
/* Find plugin declarations */
|
/* Find plugin declarations */
|
||||||
if (!(sym= dlsym(plugin_dl->handle, plugin_declarations_sym)))
|
if (!(sym= dlsym(plugin_dl->handle, plugin_declarations_sym)))
|
||||||
{
|
{
|
||||||
report_error(report, ER_CANT_FIND_DL_ENTRY, plugin_declarations_sym);
|
my_error(ER_CANT_FIND_DL_ENTRY, MyFlags, plugin_declarations_sym);
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -584,7 +562,7 @@ static my_bool read_mysql_plugin_info(struct st_plugin_dl *plugin_dl,
|
|||||||
MYF(MY_ZEROFILL|MY_WME));
|
MYF(MY_ZEROFILL|MY_WME));
|
||||||
if (!cur)
|
if (!cur)
|
||||||
{
|
{
|
||||||
report_error(report, ER_OUTOFMEMORY,
|
my_error(ER_OUTOFMEMORY, MyFlags,
|
||||||
static_cast<int>(plugin_dl->dl.length));
|
static_cast<int>(plugin_dl->dl.length));
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
@ -639,15 +617,14 @@ static my_bool read_mysql_plugin_info(struct st_plugin_dl *plugin_dl,
|
|||||||
@param plugin_dl Structure where the data should be put
|
@param plugin_dl Structure where the data should be put
|
||||||
@param sym Reverence on version info
|
@param sym Reverence on version info
|
||||||
@param dlpath Path to the module
|
@param dlpath Path to the module
|
||||||
@param report what errors should be reported
|
@param MyFlags Where errors should be reported (0 or ME_ERROR_LOG)
|
||||||
|
|
||||||
@retval FALSE OK
|
@retval FALSE OK
|
||||||
@retval TRUE ERROR
|
@retval TRUE ERROR
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static my_bool read_maria_plugin_info(struct st_plugin_dl *plugin_dl,
|
static my_bool read_maria_plugin_info(struct st_plugin_dl *plugin_dl,
|
||||||
void *sym, char *dlpath,
|
void *sym, char *dlpath, myf MyFlags)
|
||||||
int report)
|
|
||||||
{
|
{
|
||||||
DBUG_ENTER("read_maria_plugin_info");
|
DBUG_ENTER("read_maria_plugin_info");
|
||||||
|
|
||||||
@ -658,7 +635,7 @@ static my_bool read_maria_plugin_info(struct st_plugin_dl *plugin_dl,
|
|||||||
Actually this branch impossible because in case of absence of maria
|
Actually this branch impossible because in case of absence of maria
|
||||||
version we try mysql version.
|
version we try mysql version.
|
||||||
*/
|
*/
|
||||||
report_error(report, ER_CANT_FIND_DL_ENTRY,
|
my_error(ER_CANT_FIND_DL_ENTRY, MyFlags,
|
||||||
maria_plugin_interface_version_sym);
|
maria_plugin_interface_version_sym);
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
@ -668,14 +645,14 @@ static my_bool read_maria_plugin_info(struct st_plugin_dl *plugin_dl,
|
|||||||
if (plugin_dl->mariaversion < min_maria_plugin_interface_version ||
|
if (plugin_dl->mariaversion < min_maria_plugin_interface_version ||
|
||||||
(plugin_dl->mariaversion >> 8) > (MARIA_PLUGIN_INTERFACE_VERSION >> 8))
|
(plugin_dl->mariaversion >> 8) > (MARIA_PLUGIN_INTERFACE_VERSION >> 8))
|
||||||
{
|
{
|
||||||
report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, ENOEXEC,
|
my_error(ER_CANT_OPEN_LIBRARY, MyFlags, dlpath, ENOEXEC,
|
||||||
"plugin interface version mismatch");
|
"plugin interface version mismatch");
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
/* Find plugin declarations */
|
/* Find plugin declarations */
|
||||||
if (!(sym= dlsym(plugin_dl->handle, maria_plugin_declarations_sym)))
|
if (!(sym= dlsym(plugin_dl->handle, maria_plugin_declarations_sym)))
|
||||||
{
|
{
|
||||||
report_error(report, ER_CANT_FIND_DL_ENTRY, maria_plugin_declarations_sym);
|
my_error(ER_CANT_FIND_DL_ENTRY, MyFlags, maria_plugin_declarations_sym);
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
if (plugin_dl->mariaversion != MARIA_PLUGIN_INTERFACE_VERSION)
|
if (plugin_dl->mariaversion != MARIA_PLUGIN_INTERFACE_VERSION)
|
||||||
@ -688,7 +665,7 @@ static my_bool read_maria_plugin_info(struct st_plugin_dl *plugin_dl,
|
|||||||
sizeof_st_plugin= *(int *)sym;
|
sizeof_st_plugin= *(int *)sym;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
report_error(report, ER_CANT_FIND_DL_ENTRY, maria_sizeof_st_plugin_sym);
|
my_error(ER_CANT_FIND_DL_ENTRY, MyFlags, maria_sizeof_st_plugin_sym);
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,7 +682,7 @@ static my_bool read_maria_plugin_info(struct st_plugin_dl *plugin_dl,
|
|||||||
MYF(MY_ZEROFILL|MY_WME));
|
MYF(MY_ZEROFILL|MY_WME));
|
||||||
if (!cur)
|
if (!cur)
|
||||||
{
|
{
|
||||||
report_error(report, ER_OUTOFMEMORY,
|
my_error(ER_OUTOFMEMORY, MyFlags,
|
||||||
static_cast<int>(plugin_dl->dl.length));
|
static_cast<int>(plugin_dl->dl.length));
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
@ -731,7 +708,7 @@ static my_bool read_maria_plugin_info(struct st_plugin_dl *plugin_dl,
|
|||||||
}
|
}
|
||||||
#endif /* HAVE_DLOPEN */
|
#endif /* HAVE_DLOPEN */
|
||||||
|
|
||||||
static st_plugin_dl *plugin_dl_add(const LEX_CSTRING *dl, int report)
|
static st_plugin_dl *plugin_dl_add(const LEX_CSTRING *dl, myf MyFlags)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_DLOPEN
|
#ifdef HAVE_DLOPEN
|
||||||
char dlpath[FN_REFLEN];
|
char dlpath[FN_REFLEN];
|
||||||
@ -755,7 +732,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_CSTRING *dl, int report)
|
|||||||
system_charset_info, 1) ||
|
system_charset_info, 1) ||
|
||||||
plugin_dir_len + dl->length + 1 >= FN_REFLEN)
|
plugin_dir_len + dl->length + 1 >= FN_REFLEN)
|
||||||
{
|
{
|
||||||
report_error(report, ER_UDF_NO_PATHS);
|
my_error(ER_UDF_NO_PATHS, MyFlags);
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
/* If this dll is already loaded just increase ref_count. */
|
/* If this dll is already loaded just increase ref_count. */
|
||||||
@ -772,7 +749,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_CSTRING *dl, int report)
|
|||||||
/* Open new dll handle */
|
/* Open new dll handle */
|
||||||
if (!(plugin_dl.handle= dlopen(dlpath, RTLD_NOW)))
|
if (!(plugin_dl.handle= dlopen(dlpath, RTLD_NOW)))
|
||||||
{
|
{
|
||||||
report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, errno, my_dlerror(dlpath));
|
my_error(ER_CANT_OPEN_LIBRARY, MyFlags, dlpath, errno, my_dlerror(dlpath));
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
dlopen_count++;
|
dlopen_count++;
|
||||||
@ -792,12 +769,12 @@ static st_plugin_dl *plugin_dl_add(const LEX_CSTRING *dl, int report)
|
|||||||
dlsym(plugin_dl.handle,
|
dlsym(plugin_dl.handle,
|
||||||
plugin_interface_version_sym),
|
plugin_interface_version_sym),
|
||||||
dlpath,
|
dlpath,
|
||||||
report))
|
MyFlags))
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (read_maria_plugin_info(&plugin_dl, sym, dlpath, report))
|
if (read_maria_plugin_info(&plugin_dl, sym, dlpath, MyFlags))
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -815,7 +792,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_CSTRING *dl, int report)
|
|||||||
my_snprintf(buf, sizeof(buf),
|
my_snprintf(buf, sizeof(buf),
|
||||||
"service '%s' interface version mismatch",
|
"service '%s' interface version mismatch",
|
||||||
list_of_services[i].name);
|
list_of_services[i].name);
|
||||||
report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, ENOEXEC, buf);
|
my_error(ER_CANT_OPEN_LIBRARY, MyFlags, dlpath, ENOEXEC, buf);
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
tmp_backup[plugin_dl.nbackups++].save(ptr);
|
tmp_backup[plugin_dl.nbackups++].save(ptr);
|
||||||
@ -830,7 +807,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_CSTRING *dl, int report)
|
|||||||
if (!plugin_dl.ptr_backup)
|
if (!plugin_dl.ptr_backup)
|
||||||
{
|
{
|
||||||
restore_ptr_backup(plugin_dl.nbackups, tmp_backup);
|
restore_ptr_backup(plugin_dl.nbackups, tmp_backup);
|
||||||
report_error(report, ER_OUTOFMEMORY, bytes);
|
my_error(ER_OUTOFMEMORY, MyFlags, bytes);
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
memcpy(plugin_dl.ptr_backup, tmp_backup, bytes);
|
memcpy(plugin_dl.ptr_backup, tmp_backup, bytes);
|
||||||
@ -840,7 +817,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_CSTRING *dl, int report)
|
|||||||
plugin_dl.dl.length= dl->length * files_charset_info->mbmaxlen + 1;
|
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(plugin_dl.dl.length, MYF(0))))
|
||||||
{
|
{
|
||||||
report_error(report, ER_OUTOFMEMORY,
|
my_error(ER_OUTOFMEMORY, MyFlags,
|
||||||
static_cast<int>(plugin_dl.dl.length));
|
static_cast<int>(plugin_dl.dl.length));
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
@ -853,7 +830,7 @@ static st_plugin_dl *plugin_dl_add(const LEX_CSTRING *dl, int report)
|
|||||||
/* Add this dll to array */
|
/* Add this dll to array */
|
||||||
if (! (tmp= plugin_dl_insert_or_reuse(&plugin_dl)))
|
if (! (tmp= plugin_dl_insert_or_reuse(&plugin_dl)))
|
||||||
{
|
{
|
||||||
report_error(report, ER_OUTOFMEMORY,
|
my_error(ER_OUTOFMEMORY, MyFlags,
|
||||||
static_cast<int>(sizeof(struct st_plugin_dl)));
|
static_cast<int>(sizeof(struct st_plugin_dl)));
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
@ -866,7 +843,7 @@ ret:
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
DBUG_ENTER("plugin_dl_add");
|
DBUG_ENTER("plugin_dl_add");
|
||||||
report_error(report, ER_FEATURE_DISABLED, "plugin", "HAVE_DLOPEN");
|
my_error(ER_FEATURE_DISABLED, MyFlags, "plugin", "HAVE_DLOPEN");
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -1101,7 +1078,7 @@ static st_plugin_int *plugin_insert_or_reuse(struct st_plugin_int *plugin)
|
|||||||
Requires that a write-lock is held on LOCK_system_variables_hash
|
Requires that a write-lock is held on LOCK_system_variables_hash
|
||||||
*/
|
*/
|
||||||
static bool plugin_add(MEM_ROOT *tmp_root,
|
static bool plugin_add(MEM_ROOT *tmp_root,
|
||||||
const LEX_CSTRING *name, LEX_CSTRING *dl, int report)
|
const LEX_CSTRING *name, LEX_CSTRING *dl, myf MyFlags)
|
||||||
{
|
{
|
||||||
struct st_plugin_int tmp, *maybe_dupe;
|
struct st_plugin_int tmp, *maybe_dupe;
|
||||||
struct st_maria_plugin *plugin;
|
struct st_maria_plugin *plugin;
|
||||||
@ -1111,13 +1088,13 @@ static bool plugin_add(MEM_ROOT *tmp_root,
|
|||||||
|
|
||||||
if (name->str && plugin_find_internal(name, MYSQL_ANY_PLUGIN))
|
if (name->str && plugin_find_internal(name, MYSQL_ANY_PLUGIN))
|
||||||
{
|
{
|
||||||
report_error(report, ER_PLUGIN_INSTALLED, name->str);
|
my_error(ER_PLUGIN_INSTALLED, MyFlags, name->str);
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
/* Clear the whole struct to catch future extensions. */
|
/* Clear the whole struct to catch future extensions. */
|
||||||
bzero((char*) &tmp, sizeof(tmp));
|
bzero((char*) &tmp, sizeof(tmp));
|
||||||
fix_dl_name(tmp_root, dl);
|
fix_dl_name(tmp_root, dl);
|
||||||
if (! (tmp.plugin_dl= plugin_dl_add(dl, report)))
|
if (! (tmp.plugin_dl= plugin_dl_add(dl, MyFlags)))
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
/* Find plugin by name */
|
/* Find plugin by name */
|
||||||
for (plugin= tmp.plugin_dl->plugins; plugin->info; plugin++)
|
for (plugin= tmp.plugin_dl->plugins; plugin->info; plugin++)
|
||||||
@ -1143,7 +1120,7 @@ static bool plugin_add(MEM_ROOT *tmp_root,
|
|||||||
{
|
{
|
||||||
if (plugin->name != maybe_dupe->plugin->name)
|
if (plugin->name != maybe_dupe->plugin->name)
|
||||||
{
|
{
|
||||||
report_error(report, ER_UDF_EXISTS, plugin->name);
|
my_error(ER_UDF_EXISTS, MyFlags, plugin->name);
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
dupes++;
|
dupes++;
|
||||||
@ -1160,7 +1137,7 @@ static bool plugin_add(MEM_ROOT *tmp_root,
|
|||||||
plugin_type_names[plugin->type].str,
|
plugin_type_names[plugin->type].str,
|
||||||
" plugin ", tmp.name.str,
|
" plugin ", tmp.name.str,
|
||||||
" not supported by this version of the server", NullS);
|
" not supported by this version of the server", NullS);
|
||||||
report_error(report, ER_CANT_OPEN_LIBRARY, dl->str, ENOEXEC, buf);
|
my_error(ER_CANT_OPEN_LIBRARY, MyFlags, dl->str, ENOEXEC, buf);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1173,7 +1150,7 @@ static bool plugin_add(MEM_ROOT *tmp_root,
|
|||||||
" is prohibited by --plugin-maturity=",
|
" is prohibited by --plugin-maturity=",
|
||||||
plugin_maturity_names[plugin_maturity],
|
plugin_maturity_names[plugin_maturity],
|
||||||
NullS);
|
NullS);
|
||||||
report_error(report, ER_CANT_OPEN_LIBRARY, dl->str, EPERM, buf);
|
my_error(ER_CANT_OPEN_LIBRARY, MyFlags, dl->str, EPERM, buf);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
else if (plugin_maturity_map[plugin->maturity] < SERVER_MATURITY_LEVEL)
|
else if (plugin_maturity_map[plugin->maturity] < SERVER_MATURITY_LEVEL)
|
||||||
@ -1211,7 +1188,7 @@ err:
|
|||||||
DBUG_ASSERT(!name->str || !dupes); // dupes is ONLY for name->str == 0
|
DBUG_ASSERT(!name->str || !dupes); // dupes is ONLY for name->str == 0
|
||||||
|
|
||||||
if (errs == 0 && oks == 0 && !dupes) // no plugin was found
|
if (errs == 0 && oks == 0 && !dupes) // no plugin was found
|
||||||
report_error(report, ER_CANT_FIND_DL_ENTRY, name->str);
|
my_error(ER_CANT_FIND_DL_ENTRY, MyFlags, name->str);
|
||||||
|
|
||||||
plugin_dl_del(tmp.plugin_dl);
|
plugin_dl_del(tmp.plugin_dl);
|
||||||
DBUG_RETURN(errs > 0 || oks + dupes == 0);
|
DBUG_RETURN(errs > 0 || oks + dupes == 0);
|
||||||
@ -1870,7 +1847,7 @@ static void plugin_load(MEM_ROOT *tmp_root)
|
|||||||
the mutex here to satisfy the assert
|
the mutex here to satisfy the assert
|
||||||
*/
|
*/
|
||||||
mysql_mutex_lock(&LOCK_plugin);
|
mysql_mutex_lock(&LOCK_plugin);
|
||||||
plugin_add(tmp_root, &name, &dl, REPORT_TO_LOG);
|
plugin_add(tmp_root, &name, &dl, MYF(ME_ERROR_LOG));
|
||||||
free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
|
free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
|
||||||
mysql_mutex_unlock(&LOCK_plugin);
|
mysql_mutex_unlock(&LOCK_plugin);
|
||||||
}
|
}
|
||||||
@ -1926,7 +1903,7 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, const char *list)
|
|||||||
free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
|
free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
|
||||||
name.str= 0; // load everything
|
name.str= 0; // load everything
|
||||||
if (plugin_add(tmp_root, (LEX_CSTRING*) &name, (LEX_CSTRING*) &dl,
|
if (plugin_add(tmp_root, (LEX_CSTRING*) &name, (LEX_CSTRING*) &dl,
|
||||||
REPORT_TO_LOG))
|
MYF(ME_ERROR_LOG)))
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1934,7 +1911,7 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, const char *list)
|
|||||||
free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
|
free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
|
||||||
mysql_mutex_lock(&LOCK_plugin);
|
mysql_mutex_lock(&LOCK_plugin);
|
||||||
if (plugin_add(tmp_root, (LEX_CSTRING*) &name, (LEX_CSTRING*) &dl,
|
if (plugin_add(tmp_root, (LEX_CSTRING*) &name, (LEX_CSTRING*) &dl,
|
||||||
REPORT_TO_LOG))
|
MYF(ME_ERROR_LOG)))
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
mysql_mutex_unlock(&LOCK_plugin);
|
mysql_mutex_unlock(&LOCK_plugin);
|
||||||
@ -2126,7 +2103,7 @@ static bool finalize_install(THD *thd, TABLE *table, const LEX_CSTRING *name,
|
|||||||
{
|
{
|
||||||
if (plugin_initialize(thd->mem_root, tmp, argc, argv, false))
|
if (plugin_initialize(thd->mem_root, tmp, argc, argv, false))
|
||||||
{
|
{
|
||||||
report_error(REPORT_TO_USER, ER_CANT_INITIALIZE_UDF, name->str,
|
my_error(ER_CANT_INITIALIZE_UDF, MYF(0), name->str,
|
||||||
"Plugin initialization function failed.");
|
"Plugin initialization function failed.");
|
||||||
tmp->state= PLUGIN_IS_DELETED;
|
tmp->state= PLUGIN_IS_DELETED;
|
||||||
return 1;
|
return 1;
|
||||||
@ -2189,7 +2166,7 @@ bool mysql_install_plugin(THD *thd, const LEX_CSTRING *name,
|
|||||||
|
|
||||||
if (my_load_defaults(MYSQL_CONFIG_NAME, load_default_groups, &argc, &argv, NULL))
|
if (my_load_defaults(MYSQL_CONFIG_NAME, load_default_groups, &argc, &argv, NULL))
|
||||||
{
|
{
|
||||||
report_error(REPORT_TO_USER, ER_PLUGIN_IS_NOT_LOADED, name->str);
|
my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), name->str);
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2218,7 +2195,7 @@ bool mysql_install_plugin(THD *thd, const LEX_CSTRING *name,
|
|||||||
mysql_audit_acquire_plugins(thd, event_class_mask);
|
mysql_audit_acquire_plugins(thd, event_class_mask);
|
||||||
|
|
||||||
mysql_mutex_lock(&LOCK_plugin);
|
mysql_mutex_lock(&LOCK_plugin);
|
||||||
error= plugin_add(thd->mem_root, name, &dl, REPORT_TO_USER);
|
error= plugin_add(thd->mem_root, name, &dl, MYF(0));
|
||||||
if (unlikely(error))
|
if (unlikely(error))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
@ -2496,7 +2473,7 @@ bool plugin_dl_foreach(THD *thd, const LEX_CSTRING *dl,
|
|||||||
if (dl)
|
if (dl)
|
||||||
{
|
{
|
||||||
mysql_mutex_lock(&LOCK_plugin);
|
mysql_mutex_lock(&LOCK_plugin);
|
||||||
st_plugin_dl *plugin_dl= plugin_dl_add(dl, REPORT_TO_USER);
|
st_plugin_dl *plugin_dl= plugin_dl_add(dl, MYF(0));
|
||||||
mysql_mutex_unlock(&LOCK_plugin);
|
mysql_mutex_unlock(&LOCK_plugin);
|
||||||
|
|
||||||
if (!plugin_dl)
|
if (!plugin_dl)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user