[MDEV-496] Table logging does not work in TRANSACTION READ ONLY mode Created: 2012-08-28  Updated: 2012-08-30  Resolved: 2012-08-30

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: 10.0.0

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates

 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:

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

bzr version-info (10.0-monty)

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:

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:

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:

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


Generated at Thu Feb 08 06:29:10 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.