Bug #39051 UNISTALL PLUGIN defers uninstall after SELECT on any plugin table
Description:
If we do any select on installed plugin, a consequent uninstall will get deferred with a warning:
+--------------+
| version() |
+--------------+
| 5.1.28-debug |
+--------------+
1 row in set (0.00 sec)
mysql> use test;
Database changed
mysql> show plugins;
+------------+--------+----------------+---------+---------+
| Name | Status | Type | Library | License |
+------------+--------+----------------+---------+---------+
| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
+------------+--------+----------------+---------+---------+
5 rows in set (0.00 sec)
mysql> INSTALL PLUGIN INNODB SONAME 'ha_innodb.so';
Query OK, 0 rows affected (1.48 sec)
mysql> show plugins;
+------------+--------+----------------+--------------+---------+
| Name | Status | Type | Library | License |
+------------+--------+----------------+--------------+---------+
| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| InnoDB | ACTIVE | STORAGE ENGINE | ha_innodb.so | GPL |
+------------+--------+----------------+--------------+---------+
6 rows in set (0.00 sec)
mysql> create table t1 (id int primary key) engine=innodb;
Query OK, 0 rows affected (0.01 sec)
mysql> select * from t1;
Empty set (0.00 sec)
mysql> uninstall plugin innodb;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> show warnings;
+---------+------+----------------------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------------------+
| Warning | 0 | Plugin is busy and will be uninstalled on shutdown |
+---------+------+----------------------------------------------------+
1 row in set (0.01 sec)
How to repeat:
See above
Suggested fix:
The warning 'Plugin is busy...' comes from sql_plugin.cc
1718 if (plugin->ref_count)
1719 push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
1720 "Plugin is busy and will be uninstalled on shutdown");
1721 else
1722 reap_needed= true;
1723 reap_plugins();
The ref_count is non-zero because a SELECT results in incrementing it thrice but decrementing it twice. I cannot fathom the need for incrementing ref_count multiple times for the same select but this asymmetry of increment/decrement is causing the delay in uninstall.
The increments to ref_count happen in open_binary_frm() in table.cc.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.