mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
handlerton cleanup:
duplicate fields removed, st_mysql_storage_engine added to support run-time handlerton initialization (no compiler warnings), handler API is now tied to MySQL version, handlerton->plugin mapping added (slot-based), dummy default_hton removed, plugin-type-specific initialization generalized, built-in plugins are now initialized too, --default-storage-engine no longer needs a list of storage engines in handle_options(). mysql-test-run.pl bugfixes
This commit is contained in:
@ -23,12 +23,18 @@ extern struct st_mysql_plugin *mysqld_builtins[];
|
||||
|
||||
char *opt_plugin_dir_ptr;
|
||||
char opt_plugin_dir[FN_REFLEN];
|
||||
LEX_STRING plugin_type_names[]=
|
||||
LEX_STRING plugin_type_names[MYSQL_MAX_PLUGIN_TYPE_NUM]=
|
||||
{
|
||||
{ (char *)STRING_WITH_LEN("UDF") },
|
||||
{ (char *)STRING_WITH_LEN("STORAGE ENGINE") },
|
||||
{ (char *)STRING_WITH_LEN("FTPARSER") }
|
||||
};
|
||||
|
||||
plugin_type_init plugin_type_initialize[MYSQL_MAX_PLUGIN_TYPE_NUM]=
|
||||
{
|
||||
0,ha_initialize_handlerton,0
|
||||
};
|
||||
|
||||
static const char *plugin_interface_version_sym=
|
||||
"_mysql_plugin_interface_version_";
|
||||
static const char *sizeof_st_plugin_sym=
|
||||
@ -522,27 +528,15 @@ static int plugin_initialize(struct st_plugin_int *plugin)
|
||||
{
|
||||
sql_print_error("Plugin '%s' init function returned error.",
|
||||
plugin->name.str);
|
||||
DBUG_PRINT("warning", ("Plugin '%s' init function returned error.",
|
||||
plugin->name.str));
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
switch (plugin->plugin->type)
|
||||
if (plugin_type_initialize[plugin->plugin->type] &&
|
||||
(*plugin_type_initialize[plugin->plugin->type])(plugin))
|
||||
{
|
||||
case MYSQL_STORAGE_ENGINE_PLUGIN:
|
||||
if (ha_initialize_handlerton(plugin))
|
||||
{
|
||||
sql_print_error("Plugin '%s' handlerton init returned error.",
|
||||
plugin->name.str);
|
||||
DBUG_PRINT("warning", ("Plugin '%s' handlerton init returned error.",
|
||||
plugin->name.str));
|
||||
goto err;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
sql_print_error("Plugin '%s' registration as a %s failed.",
|
||||
plugin->name.str, plugin_type_names[plugin->plugin->type]);
|
||||
goto err;
|
||||
}
|
||||
|
||||
DBUG_RETURN(0);
|
||||
@ -554,14 +548,14 @@ 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:
|
||||
@ -591,7 +585,7 @@ static int plugin_finalize(THD *thd, struct st_plugin_int *plugin)
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DBUG_RETURN(0);
|
||||
err:
|
||||
DBUG_RETURN(1);
|
||||
@ -676,7 +670,7 @@ int plugin_init(void)
|
||||
get_hash_key, NULL, 0))
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
||||
/* Register all the built-in plugins */
|
||||
for (builtins= mysqld_builtins; *builtins; builtins++)
|
||||
{
|
||||
@ -684,6 +678,12 @@ int plugin_init(void)
|
||||
{
|
||||
if (plugin_register_builtin(plugin))
|
||||
goto err;
|
||||
struct st_plugin_int *tmp=dynamic_element(&plugin_array,
|
||||
plugin_array.elements-1,
|
||||
struct st_plugin_int *);
|
||||
if (plugin_initialize(tmp))
|
||||
goto err;
|
||||
tmp->state= PLUGIN_IS_READY;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user