summaryrefslogtreecommitdiff
path: root/sql/sql_plugin.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2020-07-28 10:39:05 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2020-07-29 12:34:53 +0200
commit2107e3bb9c0d2e039c371a36fe7b3d7dcb2b6c5f (patch)
tree9b38a1486f8f7a2670ad8c2fc69665aaca43f9eb /sql/sql_plugin.cc
parent8ec877f40a0e8e7432f1ef2cbd1d744c793eab2d (diff)
downloadmariadb-git-2107e3bb9c0d2e039c371a36fe7b3d7dcb2b6c5f.tar.gz
MDEV-21258: Can't uninstall plugin if the library file doesn't exist
Removing plugin from the mysql.plugin even if the plugin is not loaded
Diffstat (limited to 'sql/sql_plugin.cc')
-rw-r--r--sql/sql_plugin.cc43
1 files changed, 26 insertions, 17 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 42d2d110f2b..968ec6ac7d4 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -2216,26 +2216,30 @@ static bool do_uninstall(THD *thd, TABLE *table, const LEX_STRING *name)
if (!(plugin= plugin_find_internal(name, MYSQL_ANY_PLUGIN)) ||
plugin->state & (PLUGIN_IS_UNINITIALIZED | PLUGIN_IS_DYING))
{
- my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "PLUGIN", name->str);
- return 1;
- }
- if (!plugin->plugin_dl)
- {
- my_error(ER_PLUGIN_DELETE_BUILTIN, MYF(0));
- return 1;
+ // maybe plugin is in mysql.plugin present so postpond the error
+ plugin= NULL;
}
- if (plugin->load_option == PLUGIN_FORCE_PLUS_PERMANENT)
+
+ if (plugin)
{
- my_error(ER_PLUGIN_IS_PERMANENT, MYF(0), name->str);
- return 1;
- }
+ if (!plugin->plugin_dl)
+ {
+ my_error(ER_PLUGIN_DELETE_BUILTIN, MYF(0));
+ return 1;
+ }
+ if (plugin->load_option == PLUGIN_FORCE_PLUS_PERMANENT)
+ {
+ my_error(ER_PLUGIN_IS_PERMANENT, MYF(0), name->str);
+ return 1;
+ }
- plugin->state= PLUGIN_IS_DELETED;
- if (plugin->ref_count)
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- WARN_PLUGIN_BUSY, ER_THD(thd, WARN_PLUGIN_BUSY));
- else
- reap_needed= true;
+ plugin->state= PLUGIN_IS_DELETED;
+ if (plugin->ref_count)
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
+ WARN_PLUGIN_BUSY, ER_THD(thd, WARN_PLUGIN_BUSY));
+ else
+ reap_needed= true;
+ }
uchar user_key[MAX_KEY_LENGTH];
table->use_all_columns();
@@ -2260,6 +2264,11 @@ static bool do_uninstall(THD *thd, TABLE *table, const LEX_STRING *name)
return 1;
}
}
+ else if (!plugin)
+ {
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "PLUGIN", name->str);
+ return 1;
+ }
return 0;
}