1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00
" Configure support for server plugins "
This commit is contained in:
acurtis@xiphis.org
2006-04-13 13:49:29 -07:00
parent b02463c15a
commit 4e11a4d941
52 changed files with 1387 additions and 718 deletions

View File

@ -19,6 +19,8 @@
#define REPORT_TO_LOG 1
#define REPORT_TO_USER 2
extern struct st_mysql_plugin *mysqld_builtins[];
char *opt_plugin_dir_ptr;
char opt_plugin_dir[FN_REFLEN];
LEX_STRING plugin_type_names[]=
@ -540,6 +542,53 @@ err:
DBUG_RETURN(1);
}
static int plugin_finalize(THD *thd, struct st_plugin_int *plugin)
{
int rc;
DBUG_ENTER("plugin_finalize");
if (plugin->ref_count)
{
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"Plugin is busy and will be uninstalled on shutdown");
goto err;
}
switch (plugin->plugin->type)
{
case MYSQL_STORAGE_ENGINE_PLUGIN:
if (ha_finalize_handlerton(plugin))
{
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"Storage engine shutdown failed. "
"It will be uninstalled on shutdown");
sql_print_warning("Storage engine '%s' shutdown failed. "
"It will be uninstalled on shutdown", plugin->name.str);
goto err;
}
break;
default:
break;
}
if (plugin->plugin->deinit)
{
if ((rc= plugin->plugin->deinit()))
{
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"Plugin deinit failed. "
"It will be uninstalled on shutdown");
sql_print_warning("Plugin '%s' deinit failed. "
"It will be uninstalled on shutdown", plugin->name.str);
goto err;
}
}
DBUG_RETURN(0);
err:
DBUG_RETURN(1);
}
static void plugin_call_initializer(void)
{
uint i;
@ -598,6 +647,8 @@ static byte *get_hash_key(const byte *buff, uint *length,
int plugin_init(void)
{
int i;
struct st_mysql_plugin **builtins;
struct st_mysql_plugin *plugin;
DBUG_ENTER("plugin_init");
if (initialized)
@ -617,6 +668,16 @@ int plugin_init(void)
get_hash_key, NULL, 0))
goto err;
}
/* Register all the built-in plugins */
for (builtins= mysqld_builtins; *builtins; builtins++)
{
for (plugin= *builtins; plugin->info; plugin++)
{
if (plugin_register_builtin(plugin))
goto err;
}
}
initialized= 1;
@ -823,18 +884,10 @@ my_bool mysql_uninstall_plugin(THD *thd, LEX_STRING *name)
goto err;
}
if (plugin->ref_count)
{
plugin->state= PLUGIN_IS_DELETED;
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
"Plugin is not deleted, waiting on tables.");
}
else
{
if (plugin->plugin->deinit)
plugin->plugin->deinit();
if (!plugin_finalize(thd, plugin))
plugin_del(name);
}
else
plugin->state= PLUGIN_IS_DELETED;
table->field[0]->store(name->str, name->length, system_charset_info);
table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);