mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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
This commit is contained in:
@ -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;
|
||||
}
|
||||
if (plugin->load_option == PLUGIN_FORCE_PLUS_PERMANENT)
|
||||
{
|
||||
my_error(ER_PLUGIN_IS_PERMANENT, MYF(0), name->str);
|
||||
return 1;
|
||||
// maybe plugin is in mysql.plugin present so postpond the error
|
||||
plugin= NULL;
|
||||
}
|
||||
|
||||
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;
|
||||
if (plugin)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user