Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
10.1.19
-
None
-
linux
Description
A storage engine can easily be uninstalled as long as no open table is currently relying on that plugin.
E.g. lets create a BLACKHOLE table, then uninstall the plugin right away while the table still exists. This works fine:
MariaDB [test]> install soname "ha_blackhole";
|
Query OK, 0 rows affected (0.00 sec)
|
|
|
MariaDB [test]> create table t1 (id int primary key) engine=BLACKHOLE;
|
Query OK, 0 rows affected (0.01 sec)
|
|
|
MariaDB [test]> uninstall plugin blackhole;
|
Query OK, 0 rows affected (0.00 sec)
|
Doing a FLUSH TABLES after using the table and before uninstalling the plugin also works (but obviously there is potential for a race condition now):
MariaDB [test]> install soname "ha_blackhole";
|
Query OK, 0 rows affected (0.00 sec)
|
|
|
MariaDB [test]> select * from t1;
|
Empty set (0.01 sec)
|
|
|
MariaDB [test]> flush tables;
|
Query OK, 0 rows affected (0.00 sec)
|
|
|
MariaDB [test]> uninstall plugin blackhole;
|
Query OK, 0 rows affected (0.00 sec)
|
Now lets try without FLUSH TABLES:
MariaDB [test]> install soname "ha_blackhole";
|
Query OK, 0 rows affected (0.00 sec)
|
|
|
MariaDB [test]> select * from t1;
|
Empty set (0.00 sec)
|
|
|
MariaDB [test]> uninstall plugin blackhole;
|
Query OK, 0 rows affected, 1 warning (0.00 sec)
|
|
|
MariaDB [test]> show warnings;
|
+---------+------+----------------------------------------------------+
|
| Level | Code | Message |
|
+---------+------+----------------------------------------------------+
|
| Warning | 1620 | Plugin is busy and will be uninstalled on shutdown |
|
+---------+------+----------------------------------------------------+
|
1 row in set (0.00 sec)
|
|
|
MariaDB [test]> show plugins;
|
+-------------------------------+----------+--------------------+-----------------+---------+
|
| Name | Status | Type | Library | License |
|
+-------------------------------+----------+--------------------+-----------------+---------+
|
[...]
|
| BLACKHOLE | DELETED | STORAGE ENGINE | ha_blackhole.so | GPL |
|
+-------------------------------+----------+--------------------+-----------------+---------+
|
56 rows in set (0.00 sec)
|
Fair enough. But maybe we can flush, then try UNINSTALL once more? Unfortunately not really:
MariaDB [test]> flush tables;
|
Query OK, 0 rows affected (0.00 sec)
|
|
|
MariaDB [test]> uninstall plugin blackhole;
|
ERROR 1305 (42000): PLUGIN blackhole does not exist
|
Funny enough though: SHOW PLUGINS no longer shows an entry for BLACKHOLE anymore though.
Now for the real problem though: I stopped the mysqld server process with mysqladmin shutdown and restarted it, and found the plugin to be alive and kicking again:
MariaDB [test]> show status like "uptime"; -- verify that it *really* got restarted
|
+---------------+-------+
|
| Variable_name | Value |
|
+---------------+-------+
|
| Uptime | 5 |
|
+---------------+-------+
|
1 row in set (0.00 sec)
|
|
|
MariaDB [test]> show plugins;
|
+-------------------------------+----------+--------------------+-----------------+---------+
|
| Name | Status | Type | Library | License |
|
+-------------------------------+----------+--------------------+-----------------+---------+
|
[...]
|
| BLACKHOLE | ACTIVE | STORAGE ENGINE | ha_blackhole.so | GPL |
|
+-------------------------------+----------+--------------------+-----------------+---------+
|
56 rows in set (0.00 sec)
|
So "Plugin is busy and will be uninstalled on shutdown" turns out to be not true.
This is independent of the extra FLUSH/UNINSTALL step after seeing the warning, it happens to come back from the dead in both cases.
Only safe way to get rid of the plugin is to FLUSH TABLES to close all tables using it before trying to uninstall. Unfortunately there's the possibility that another connection uses the table again between FLUSH and UNINSTALL ...