Bug #96764 audit log plugin can not be reinstalled
Submitted: 5 Sep 6:49 Modified: 12 Nov 4:30
Reporter: tu ming Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Security: Audit Severity:S3 (Non-critical)
Version:8.0.17 OS:CentOS
Assigned to: CPU Architecture:Any
Tags: regression

[5 Sep 6:49] tu ming
Description:
Error when I reinstall the audit log plugin. MySQL8.0.16 is OK. It seems a bug introdued by the fix of Bug#29248047. commit is here:https://github.com/mysql/mysql-server/commit/6a893b8b3238e749e9d1b733a300ada9316f17ea#diff...

How to repeat:
1.install plugin audit_log SONAME 'audit_log.so';
show plugins can get correct audit log plugin entry.
| audit_log                       | ACTIVE   | AUDIT              | audit_log.so |
2.uninstall plugin audit_log;
show plugins will show audit log plugin is deleted
| audit_log                       | DELETED  | AUDIT              | audit_log.so |
3.install plugin audit_log SONAME 'audit_log.so';
ERROR 1125 (HY000): Function 'audit_log' already exists
show plugins can not get audit log plugin entry.
[5 Sep 7:23] Umesh Shastry
Hello tu ming,

Thank you for the report and feedback.
Verified as described.

regards,
Umesh
[6 Sep 14:56] Marek Szymczak
This is not a bug. You need to disconnect and connect again between step 2 and 3.
[10 Sep 7:05] tu ming
If there are more than one connection on currect mysql server. login and logout again is not ok. The deleted audit log plugin would uninstalled totally once all connections over. you can have a try.
[15 Oct 7:09] tu ming
Furthermore, the percona audit log plugin does not support this behavior either.
Here is the source code: https://github.com/percona/percona-server/blob/8.0/sql/sql_plugin.cc

bool Sql_cmd_uninstall_plugin::execute(THD *thd) {
  bool st = mysql_uninstall_plugin(thd, &m_comment);
  if (!st) my_ok(thd);
  mysql_audit_release(thd);
  return st;
}