Bug #83032 Audit interface not available on embedded server
Submitted: 18 Sep 2016 14:51 Modified: 19 Sep 2016 11:54
Reporter: smptee ebu Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Embedded Library ( libmysqld ) Severity:S3 (Non-critical)
Version:5.7.15 OS:Any
Assigned to: CPU Architecture:Any

[18 Sep 2016 14:51] smptee ebu
Description:
The AUDIT plugins cannot be loaded on embedded server, because the whole audit infrastructure (sql/audit_plugin.cc) is left out when compiling libmysqld.a and libmysqld.so. Consequently, AUDIT plugin cannot be loaded. This seems to be known as the following code in sql/sql_plugin.cc serves to prevent any such plugin from loading. 

#ifdef EMBEDDED_LIBRARY
// Dummy implementations for embedded
int initialize_audit_plugin(st_plugin_int *plugin) { return 1; }
int finalize_audit_plugin(st_plugin_int *plugin) { return 0; }
#endif 

1. Embedded server is claimed to be the same as mysqld; with audit missing, it now lacks an important piece of the puzzle (eg., one is one unable to run any rewrite plugin on embedded). 

2. Docs make no mention of this limitation. 

3. Nothing in the logs reveal that such limitation is, at least for the time being, intentional. A simple log entry in the first dummy function above could have saved many hours of tracing. 

How to repeat:
Just compile a program that uses libmysqld.a or libmysqld.so and try to load an audit plugin (e.g., rewrite_example.so). 

To get past the "unresolved symbol PSI_server", just exclude the usage of PSI in the plug-in - it is not needed when doing a simple "will it load" test.

Suggested fix:
Make changes to CMake files so that the "sql" convenient library (which contains the audit) can be included, if not in libysqld.a, at least in libmysqld.so. 

Alternatively, make the changes in CMake files to have audit_plugin.* compiled when libmysqld.a is built.
[19 Sep 2016 11:40] Marek Szymczak
I confirm that audit plugin infrastructure is not compiled in for embedded library, so no audit plugin could be loaded and used. Rewrite query plugin is also audit plugin. It also won't work.
[19 Sep 2016 11:54] Chiranjeevi Battula
Hello smptee ebu,

Thank you for the bug report.
Above comment confirmed by dev and it is an expected behavior and hence marking it as Not a Bug.

Thanks,
Chiranjeevi.