summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2021-08-28 18:19:56 +0200
committerSergei Golubchik <serg@mariadb.org>2021-09-14 15:53:38 +0200
commitc5951e4d2445d9850c7d83f23ccb2abce4ba4d69 (patch)
tree9293dcc731b136f19d5692bdabb7738b326a0875
parent0629711db43ec489a360d8f689b72fac66a2470b (diff)
downloadmariadb-git-c5951e4d2445d9850c7d83f23ccb2abce4ba4d69.tar.gz
cleanup: plugin unload
* reduce code duplication
-rw-r--r--sql/sql_plugin.cc29
1 files changed, 11 insertions, 18 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index ab13e8cc569..9125db9c226 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -1261,23 +1261,16 @@ static void plugin_deinitialize(struct st_plugin_int *plugin, bool ref_check)
remove_status_vars(show_vars);
}
- if (plugin_type_deinitialize[plugin->plugin->type])
- {
- if ((*plugin_type_deinitialize[plugin->plugin->type])(plugin))
- {
- sql_print_error("Plugin '%s' of type %s failed deinitialization",
- plugin->name.str, plugin_type_names[plugin->plugin->type].str);
- }
- }
- else if (plugin->plugin->deinit)
+ plugin_type_init deinit= plugin_type_deinitialize[plugin->plugin->type];
+ if (!deinit)
+ deinit= (plugin_type_init)(plugin->plugin->deinit);
+
+ if (deinit && deinit(plugin))
{
- DBUG_PRINT("info", ("Deinitializing plugin: '%s'", plugin->name.str));
- if (plugin->plugin->deinit(plugin))
- {
- DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
- plugin->name.str));
- }
+ sql_print_error("Plugin '%s' of type %s failed deinitialization",
+ plugin->name.str, plugin_type_names[plugin->plugin->type].str);
}
+
plugin->state= PLUGIN_IS_UNINITIALIZED;
if (ref_check && plugin->ref_count)
@@ -1339,7 +1332,7 @@ static void reap_plugins(void)
list= reap;
while ((plugin= *(--list)))
- plugin_deinitialize(plugin, true);
+ plugin_deinitialize(plugin, true);
mysql_mutex_lock(&LOCK_plugin);
@@ -2352,7 +2345,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
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]);
if (unlikely(error))
{
@@ -4407,7 +4400,7 @@ int thd_setspecific(MYSQL_THD thd, MYSQL_THD_KEY_T key, void *value)
DBUG_ASSERT(key != INVALID_THD_KEY);
if (key == INVALID_THD_KEY || (!thd && !(thd= current_thd)))
return EINVAL;
-
+
memcpy(intern_sys_var_ptr(thd, key, true), &value, sizeof(void*));
return 0;
}