Commit 06a8412b authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: plugin unload

* reduce code duplication
parent 3050d5e8
...@@ -1263,23 +1263,16 @@ static void plugin_deinitialize(struct st_plugin_int *plugin, bool ref_check) ...@@ -1263,23 +1263,16 @@ static void plugin_deinitialize(struct st_plugin_int *plugin, bool ref_check)
remove_status_vars(show_vars); remove_status_vars(show_vars);
} }
if (plugin_type_deinitialize[plugin->plugin->type]) plugin_type_init deinit= plugin_type_deinitialize[plugin->plugin->type];
{ if (!deinit)
if ((*plugin_type_deinitialize[plugin->plugin->type])(plugin)) deinit= (plugin_type_init)(plugin->plugin->deinit);
{
sql_print_error("Plugin '%s' of type %s failed deinitialization", if (deinit && deinit(plugin))
plugin->name.str, plugin_type_names[plugin->plugin->type].str);
}
}
else if (plugin->plugin->deinit)
{ {
DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str)); sql_print_error("Plugin '%s' of type %s failed deinitialization",
if (plugin->plugin->deinit(plugin)) plugin->name.str, plugin_type_names[plugin->plugin->type].str);
{
DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
plugin->name.str));
}
} }
plugin->state= PLUGIN_IS_UNINITIALIZED; plugin->state= PLUGIN_IS_UNINITIALIZED;
if (ref_check && plugin->ref_count) if (ref_check && plugin->ref_count)
...@@ -1341,7 +1334,7 @@ static void reap_plugins(void) ...@@ -1341,7 +1334,7 @@ static void reap_plugins(void)
list= reap; list= reap;
while ((plugin= *(--list))) while ((plugin= *(--list)))
plugin_deinitialize(plugin, true); plugin_deinitialize(plugin, true);
mysql_mutex_lock(&LOCK_plugin); mysql_mutex_lock(&LOCK_plugin);
...@@ -2354,7 +2347,7 @@ static bool do_uninstall(THD *thd, TABLE *table, const LEX_CSTRING *name) ...@@ -2354,7 +2347,7 @@ 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 of the delete from the plugin table, so that it is not replicated in
row based mode. row based mode.
*/ */
table->file->row_logging= 0; // No logging table->file->row_logging= 0; // No logging
error= table->file->ha_delete_row(table->record[0]); error= table->file->ha_delete_row(table->record[0]);
if (unlikely(error)) if (unlikely(error))
{ {
...@@ -4409,7 +4402,7 @@ int thd_setspecific(MYSQL_THD thd, MYSQL_THD_KEY_T key, void *value) ...@@ -4409,7 +4402,7 @@ int thd_setspecific(MYSQL_THD thd, MYSQL_THD_KEY_T key, void *value)
DBUG_ASSERT(key != INVALID_THD_KEY); DBUG_ASSERT(key != INVALID_THD_KEY);
if (key == INVALID_THD_KEY || (!thd && !(thd= current_thd))) if (key == INVALID_THD_KEY || (!thd && !(thd= current_thd)))
return EINVAL; return EINVAL;
memcpy(intern_sys_var_ptr(thd, key, true), &value, sizeof(void*)); memcpy(intern_sys_var_ptr(thd, key, true), &value, sizeof(void*));
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment