Uploaded image for project: 'MariaDB Server'
  1. MDEV-496

Table logging does not work in TRANSACTION READ ONLY mode

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects versions: None
    • Fix versions: 10.0.0
    • Components: None
    • Labels:
      None
    • Sprint:

      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
      

        Attachments

          Activity

            People

            • Assignee:
              holyfoot Alexey Botchkov
              Reporter:
              elenst Elena Stepanova
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours
                6h