Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 2.72 KB

DEVELOP.md

File metadata and controls

56 lines (39 loc) · 2.72 KB

Development

Before making any code changes, read the following documentation:

Notes on MariaDB and MySQL differences

The MariaDB Audit Plugin is not compatible with MySQL 8.0 mainly because:

  • In MySQL 5.7, major changes in plugin_audit.h made the MySQL audit plugin API diverge from MariaDB. In MySQL 8.0, additional changes caused the plugin to diverge from both MySQL 5.7 and MariaDB.
  • In MySQL 8.0, the mysql_global.h was removed. See bug report for details.

Note: There is a known issue related to the system variable server_audit_loc_info. Because this system variable is for plugin developer only, it should be invisible to the customer. We set PLUGIN_VAR_NOSYSVAR | PLUGIN_VAR_NOCMDOPT | PLUGIN_VAR_MEMALLOC for it but it is still visible to the MySQL customers.

Debugging

The MySQL example audit plugin is useful for exploring the details of the audit events. Modify or add an extra print in the audit null code to get the event information.

Tests

See the server_audit.test file to view tests. The expectation for all future code changes that add a feature or fix a bug is that they also extend or update the tests accordingly.

Note MySQL does not support a thread pool, so there is only one test for MySQL 8.0 to test audit plugin functionality with a single thread.

Running test suite with mysql-test-run

./mysql-test-run --suite=server_audit

Updating tests

When there is a difference between the expected result and actual result, move the expected result to a backup and regenerate the result.

Generate test result file by running:

./mysql-test-run --do-test=server_audit --record server_audit --verbose

After you have both results, you can diff these two files. Note that failures are often caused by extra spaces.