diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2020-07-28 10:39:05 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2020-07-28 14:06:56 +0200 |
commit | 14affeb70b66552ec83340ff67cbf48492edd96b (patch) | |
tree | 5e06e7834e6ae7589cd5a2cd9e7296ffd79aa52a /sql/sql_plugin.cc | |
parent | db87a9cddab2600cefd822e9ecacff5736645c2d (diff) | |
download | mariadb-git-bb-10.2-MDEV-21258.tar.gz |
MDEV-21258: (p1) Can't uninstall plugin if the library file doesn't existbb-10.2-MDEV-21258
Part 1: 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.cc | 43 |
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; } |