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

UPDATE fails with row binlogging and succeeds otherwise, causes replication problems

    XMLWordPrintable

Details

    • Can result in data loss

    Description

      In the test case below, if the UPDATE is binlogged as a statement (or not binlogged at all), it succeeds; but if it is going to be binlogged in row format, it fails with ER_DIVISION_BY_ZERO.

      Besides the inconsistency, it easily causes replication failures when the slave runs with log-slave-updates and ROW binlog format. In the test case it is set to RBR explicitly, but there can be also runtime reasons why the master runs in MBR but the slave in RBR.

      --source include/have_innodb.inc
      --source include/have_binlog_format_mixed.inc
      --source include/master-slave.inc
       
      --connection slave
      --source include/stop_slave.inc
      SET GLOBAL binlog_format = ROW;
      --source include/start_slave.inc
       
      --connection master
      CREATE TABLE t1 (a INT, b INT, c INT, v INT AS (a DIV b) PERSISTENT) ENGINE=InnoDB;
      INSERT IGNORE INTO t1 (a,b,c) VALUES (1,0,0);
       
      UPDATE t1 SET c=1;
       
      --sync_slave_with_master
       
      --source include/stop_slave.inc
      SET GLOBAL binlog_format = MIXED;
      --source include/start_slave.inc
       
      --connection master
      DROP TABLE t1;
      --source include/rpl_end.inc
      

      11.4 151631b8cffcbf6510501262e36d950780ee4bc8

      Last_Errno      1365
      Last_Error      Error 'Division by 0' on query. Default database: 'test'. Query: 'UPDATE t1 SET c=1'
      

      The behavior changed after this commit in 11.4.11:

      commit a4e4a56720c974b547d4e469a8c54510318bc2c9
      Author: Kristian Nielsen
      Date:   Tue Feb 3 12:51:19 2026 +0100
       
          MDEV-38734: Virtual columns wrongly included in binlog_row_image=MINIMAL
      

      Before the commit, UPDATE fails regardless whether it's run with statement or row binary logging (or without any), so it would not reach the slave to cause a problem.

      Attachments

        Issue Links

          Activity

            People

              knielsen Kristian Nielsen
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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