We're updating the issue view to help you get more done. 

Table logging does not work in TRANSACTION READ ONLY mode

Description

In TRANSACTION READ ONLY mode, if general logging is enabled and directed to the table, MariaDB does not update the log table, and instead writes error messages in the error log:

1 [ERROR] Failed to write to mysql.general_log: Cannot execute statement in a READ ONLY transaction.

bzr version-info (10.0-monty)

1 2 3 4 revision-id: holyfoot@askmonty.org-20120825155717-6ot5fleyej4ublum date: 2012-08-25 20:57:17 +0500 build-date: 2012-08-28 22:33:49 +0400 revno: 3434

It works fine in MySQL 5.6, revno 3917.

Test case:

1 2 3 4 5 6 SET GLOBAL general_log=1; SET GLOBAL log_output='TABLE'; SET GLOBAL TRANSACTION READ ONLY; --connect (con1,localhost,root,,) SELECT * FROM mysql.general_log;

Output in MariaDB:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 SET GLOBAL general_log=1; SET GLOBAL log_output='TABLE'; SET GLOBAL TRANSACTION READ ONLY; SELECT * FROM mysql.general_log; event_time user_host thread_id server_id command_type argument 2012-08-28 22:39:22.248198 root[root] @ localhost [] 2 1 Query SET GLOBAL TRANSACTION READ ONLY main.t1 [ fail ] Found warnings/errors in server log file! Test ended at 2012-08-28 22:39:22 Warnings: line 120828 22:39:22 [ERROR] Failed to write to mysql.general_log: Cannot execute statement in a READ ONLY transaction. 120828 22:39:22 [ERROR] Failed to write to mysql.general_log: Cannot execute statement in a READ ONLY transaction. 120828 22:39:22 [ERROR] Failed to write to mysql.general_log: Cannot execute statement in a READ ONLY transaction. ^ Found warnings in /home/elenst/10.0-monty/mysql-test/var/log/mysqld.1.err

Output in MySQL 5.6:

1 2 3 4 5 6 7 8 9 SET GLOBAL general_log=1; SET GLOBAL log_output='TABLE'; SET GLOBAL TRANSACTION READ ONLY; SELECT * FROM mysql.general_log; event_time user_host thread_id server_id command_type argument 2012-08-28 21:40:03 root[root] @ localhost [] 2 1 Query SET GLOBAL tx_read_only=1 2012-08-28 21:40:03 [root] @ localhost [] 3 1 Connect root@localhost on test 2012-08-28 21:40:03 root[root] @ localhost [] 3 1 Query SELECT * FROM mysql.general_log main.t1 [ pass ] 119

Environment

None

Status

Assignee

Alexey Botchkov

Reporter

Elena Stepanova

Labels

None

External issue ID

None

External issue ID

None

Fix versions

Priority

Minor