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

Statements executed under LOCK TABLES are binlogged as committed but are not committed in Aria until UNLOCK TABLES

    XMLWordPrintable

Details

    • Can result in unexpected behaviour

    Description

      Statements executed under LOCK TABLES are binlogged as committed but are not committed in Aria until UNLOCK TABLES

      --source include/have_log_bin.inc
      --source include/not_valgrind.inc
      RESET MASTER;
      CREATE TABLE t1 (a INT) ENGINE=Aria;
      INSERT INTO t1 VALUES (1),(2);
      LOCK TABLES t1 WRITE;
      INSERT INTO t1 VALUES (3),(4);
      SELECT COUNT(*) FROM t1;          # 4
      --source include/kill_mysqld.inc
      --source include/start_mysqld.inc
      SELECT COUNT(*) FROM t1;          # 2  <-- rows 3,4 lost
      CHECK TABLE t1;                   # status OK
      --let $binlog_file= master-bin.000001
      --source include/show_binlog_events.inc   # INSERT INTO t1 VALUES (3),(4) is there, BEGIN ... COMMIT
      DROP TABLE t1;
      

      MTR Output

      LOCK TABLES t1 WRITE;
      INSERT INTO t1 VALUES (3),(4);
      SELECT COUNT(*) FROM t1;
      COUNT(*)
      4
      # Kill the server
      # restart
      SELECT COUNT(*) FROM t1;
      COUNT(*)
      2
      CHECK TABLE t1;
      Table	Op	Msg_type	Msg_text
      test.t1	check	status	OK
      include/show_binlog_events.inc
      Log_name	Pos	Event_type	Server_id	End_log_pos	Info
      master-bin.000001	#	Gtid	#	#	GTID #-#-#
      master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT) ENGINE=Aria
      master-bin.000001	#	Gtid	#	#	BEGIN GTID #-#-#
      master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1),(2)
      master-bin.000001	#	Query	#	#	COMMIT
      master-bin.000001	#	Gtid	#	#	BEGIN GTID #-#-#
      master-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (3),(4)
      master-bin.000001	#	Query	#	#	COMMIT
      

      Attachments

        Activity

          People

            monty Michael Widenius
            ramesh Ramesh Sivaraman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 0d
                0d
                Remaining:
                Time Spent - 0.5h Remaining Estimate - 0.5d
                0.5d
                Logged:
                Time Spent - 0.5h Remaining Estimate - 0.5d
                0.5h

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.