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

UPDATE on System-Versioned Tables uses the after-value in Row-format Binlog's before-image for non-trivial Text/Blob Virtual Columns

    XMLWordPrintable

Details

    Description

      --source include/have_binlog_format_row.inc
      --source include/master-slave.inc
      CREATE TABLE t (a TEXT, v TEXT AS (RIGHT(a, 1)) VIRTUAL)
        WITH SYSTEM VERSIONING AS SELECT 'before' AS a;
       
      UPDATE t SET a='after';
      --sync_slave_with_master
        SELECT * FROM t;
      --connection master
       
      DROP TABLE t;
      --source include/rpl_end.inc
      

      The slave SQL thread errors with ER_KEY_NOT_FOUND, "Could not execute Update_rows_v1 event on table test.t; Can't find record in 't', ..."
      mariadb-binlog -v on the master binary log or slave relay log reveals that the UPDATE part of the System-Versioned UPDATE has a before-image of v='r',a='before',… which should be v='e',a='before',….
      The after-image is correct (v='r',a='after',…), and so is the step that INSERTs the previous version (v='e',a='before',…).

      Also affects BLOB, but (apparently) not numeric data types.
      MDEV-24646 shows that mixing TEXT and BLOB leads to use-after-free, which is a crash risk.

      Unversioned tables are not affected.
      PERSISTENT generated columns are also not affected (besides MDEV-30441).

      Attachments

        Issue Links

          Activity

            People

              ParadoxV5 Jimmy Hú
              ParadoxV5 Jimmy Hú
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.