mariadb/mysql-test/suite/galera/r/MDEV-35511.result
sjaakola f0c2753cd1 MDEV-35511: Backport fix for Audit log not reporting user in Galera cluster
Setting a name for the the THD::security_ctx:user field for wsrep applier threads.
With this, the audit log events related to wsrep applying will be written in the
audit log.

Using user name <wsrep_applier> for wsrep appliers. This is for having identical
look with async replication, which uses: <replication_slave> for audit logging.

Using same approach as async replication to replace the security_ctx user name
with "system user" for processlist output.

Commit has also a mtr test galera.MDEV-35511, to verify wsrep applier audit logging.
The test does not install/uninstall audit log plugin, but loads the audit log plugin
before the test. This is because uninstalling the audit log plugin gives a warning
saying that plugin is busy and uninstall will be delayed until server shutdown.
This anomaly must be because of the applier thread being active audit logger.
Same problem with plugin uninstall happens also with async relication workers.
If plugn would remain installed, the post test sanity check complains of mismatching
state of pre and post test states, and test execution would fail for this.
2025-11-13 13:00:22 +02:00

22 lines
880 B
Text

connection node_2;
connection node_1;
connection node_2;
SET GLOBAL server_audit_logging=ON;
connection node_1;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1);
connection node_2;
# Now checking the audit log
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'SET GLOBAL server_audit_logging=ON',0
TIME,HOSTNAME,<wsrep_applier>,,ID,ID,CREATE,test,t1,
TIME,HOSTNAME,<wsrep_applier>,,ID,ID,WRITE,test,t1,
TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t1,
TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,table_stats,
TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,column_stats,
TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,index_stats,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'SELECT COUNT(*) = 1 FROM test.t1',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'SELECT @@datadir',0
# resetting the test state
SET GLOBAL server_audit_logging=DEFAULT;
connection node_1;
DROP TABLE t1;