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

Row events in statement based binlog: optimization possible?

    XMLWordPrintable

Details

    • Can result in unexpected behaviour
    • Q4/2026 Server Maintenance, Q1/2027 Server Maintenance

    Description

      Original t/c credit: nikitamalyavin

      --source include/have_binlog_format_statement.inc
      CREATE TEMPORARY TABLE tt1 (c INT);
      INSERT INTO tt1 VALUES (1);
      CREATE TEMPORARY TABLE tt2 (c INT PRIMARY KEY);
      INSERT tt2 VALUES (1),(2);
      --error ER_DUP_ENTRY
      UPDATE tt2, tt1 SET tt2.c=2;
      CREATE TABLE t1 (c INT);
      INSERT t1 SELECT * FROM tt2;
      SHOW BINLOG EVENTS;
      # Cleanup
      DROP TABLE tt1, tt2, t1;
      

      Leads to:

      CS 12.2.2 6ca70dd64ce56da40fad3bcd0641493210dd0a4c (Optimized, Clang 21.1.3-20250923) Build 23/01/2026

      ...
      master-bin.000001	1243	Annotate_rows	1	0	INSERT t1 SELECT * FROM tt2
      master-bin.000001	1293	Table_map	1	0	table_id: 32 (test.t1)
      master-bin.000001	1338	Write_rows_v1	1	0	table_id: 32 flags: STMT_END_F
      

      Confirmed in binlog:

      MDEV-35915-v11 CS 12.2.0 8934bac9ea05b79f7a5109d9e980cb939a24d4e3 (Debug, Clang 21.1.3-20250923) Build 19/01/2026

      mariadb-test$ ../bin/mariadb-binlog --base64-output=decode-rows -vvv var/mysqld.1/data/master-bin.00[0-9][0-9][0-9][0-9] | grep '^###'
      ### INSERT INTO `test`.`t1`
      ### SET
      ###   @1=1 /* INT meta=0 nullable=1 is_null=0 */
      ### INSERT INTO `test`.`t1`
      ### SET
      ###   @1=2 /* INT meta=0 nullable=1 is_null=0 */
      

      Introduced by MDEV-36099, potentially possible to be optimized towards regular SBR for the given testcase.

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              Roel Roel Van de Paar
              Pranav Kumar Tiwari Pranav Kumar Tiwari
              Michael Widenius Michael Widenius
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 7d
                  7d
                  Remaining:
                  Time Spent - 3d 5.5h Remaining Estimate - 3d 2.5h
                  3d 2.5h
                  Logged:
                  Time Spent - 3d 5.5h Remaining Estimate - 3d 2.5h
                  3d 5.5h

                  Git Integration

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