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

UPDATE fails on replica replicating blob virtual column in NOBLOB mode when replica logging is off

    XMLWordPrintable

Details

    • Q3/2025 Maintenance

    Description

      # Requires standard m/s replication. Use RBR or MBR.
      SET binlog_row_image='NOBLOB';
      CREATE TABLE t (c INT PRIMARY KEY, d INT, i BLOB GENERATED ALWAYS AS (c), KEY k(i)) ENGINE=InnoDB;
      CREATE TEMPORARY TABLE t2 (c INT) ENGINE=InnoDB;
      INSERT INTO t (c) VALUES (1);
      SELECT * FROM performance_schema.global_status;
      UPDATE t SET d=0;
      

      Leads to:

      10.6.18 33af5575a976c86163752cce77dddb640ffeef00 (Optimized, Slave)

      2024-04-23 10:31:44 6 [ERROR] InnoDB: Record in index `k` of table `test`.`t` was not found on update: TUPLE (info_bits=0, 2 fields): {NULL,[4] (0x80000001)} at: COMPACT RECORD(info_bits=0, 1 fields): {[8]infimum (0x696E66696D756D00)}
      2024-04-23 10:31:44 6 [ERROR] InnoDB: We detected index corruption in an InnoDB type table. You have to dump + drop + reimport the table or, in a case of widespread corruption, dump all InnoDB tables and recreate the whole tablespace. If the mariadbd server crashes after the startup or when you dump the tables. Please refer to https://mariadb.com/kb/en/library/innodb-recovery-modes/ for information about forcing recovery.
      2024-04-23 10:31:44 6 [Warning] InnoDB: Record in index `k` of table `test`.`t` was not found on rollback, trying to insert: TUPLE (info_bits=0, 2 fields): {NULL,[4] (0x80000001)} at: COMPACT RECORD(info_bits=0, 1 fields): {[8]infimum (0x696E66696D756D00)}
      2024-04-23 10:31:44 6 [ERROR] mariadbd: Index for table 't' is corrupt; try to repair it
      2024-04-23 10:31:44 6 [ERROR] Slave SQL: Could not execute Update_rows_v1 event on table test.t; Index for table 't' is corrupt; try to repair it, Error_code: 1034; handler error HA_ERR_CRASHED; the event's master log binlog.000001, end_log_pos 1595, Gtid 0-1-7, Internal MariaDB error code: 1034
      2024-04-23 10:31:44 6 [Warning] Slave: Index for table 't' is corrupt; try to repair it Error_code: 1034
      2024-04-23 10:31:44 6 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'binlog.000001' position 1416; GTID position '0-1-6'
      

      Reproduce

      --source include/have_innodb.inc
      --source include/have_binlog_format_row.inc
      --source include/master-slave.inc
       
      --connection slave
      select @@log_slave_updates;
      --connection master
      set binlog_row_image= 'NOBLOB';
      create table t (
        c int primary key, d int,
        i blob generated always as (c), key k(i)) engine=innodb;
      insert into t (c) values (1);
      update t set d= 0;
      --sync_slave_with_master
       
      --connection master
      drop table t;
       
      --source include/rpl_end.inc
      

      -slave.opt file must contain:

      --log-slave-updates=0
      

      Result

      #12 0x00007ffff7639206 in __assert_fail (assertion=0x555555e71eda "0", file=0x555555e9e24b "../src/storage/innobase/row/row0upd.cc", line=1931, function=0x555555d7443c "dberr_t row_upd_sec_index_entry(upd_node_t *, que_thr_t *)") at ./assert/assert.c:101
      #13 0x00005555572905dc in row_upd_sec_index_entry (node=0x7fffac043de8, thr=0x7fffac931e88) at ../src/storage/innobase/row/row0upd.cc:1931
      #14 0x000055555728bc1d in row_upd_sec_step (node=0x7fffac043de8, thr=0x7fffac931e88) at ../src/storage/innobase/row/row0upd.cc:2059
      #15 0x0000555557289efe in row_upd (node=0x7fffac043de8, thr=0x7fffac931e88) at ../src/storage/innobase/row/row0upd.cc:2806
      #16 0x000055555728993e in row_upd_step (thr=0x7fffac931e88) at ../src/storage/innobase/row/row0upd.cc:2921
      #17 0x000055555722bf2c in row_update_for_mysql (prebuilt=0x7fffac0433a8) at ../src/storage/innobase/row/row0mysql.cc:1667
      #18 0x0000555556eae906 in ha_innobase::update_row (this=0x7fffac041348, old_row=0x7fffac041b60 "\377\001", new_row=0x7fffac041b48 "\374\001") at ../src/storage/innobase/handler/ha_innodb.cc:8605
      #19 0x0000555556587f0f in handler::ha_update_row (this=0x7fffac041348, old_data=0x7fffac041b60 "\377\001", new_data=0x7fffac041b48 "\374\001") at ../src/sql/handler.cc:7829
      #20 0x00005555566f0857 in Update_rows_log_event::do_exec_row (this=0x7fffac0368c8, rgi=0x7fffac000d40) at ../src/sql/log_event_server.cc:9004
      #21 0x00005555566e7728 in Rows_log_event::do_apply_event (this=0x7fffac0368c8, rgi=0x7fffac000d40) at ../src/sql/log_event_server.cc:6214
      #22 0x0000555556703c42 in Log_event::apply_event (this=0x7fffac0368c8, rgi=0x7fffac000d40) at ../src/sql/log_event.cc:4255
      #23 0x00005555567de91e in apply_event_and_update_pos_apply (ev=0x7fffac0368c8, thd=0x7fffac001b08, rgi=0x7fffac000d40, reason=0) at ../src/sql/slave.cc:3968
      #24 0x00005555567de574 in apply_event_and_update_pos (ev=0x7fffac0368c8, thd=0x7fffac001b08, rgi=0x7fffac000d40) at ../src/sql/slave.cc:4144
      #25 0x00005555567e83bf in exec_relay_log_event (thd=0x7fffac001b08, rli=0x555558bae9f0, serial_rgi=0x7fffac000d40) at ../src/sql/slave.cc:4570
      #26 0x00005555567d6952 in handle_slave_sql (arg=0x555558bac930) at ../src/sql/slave.cc:5825
      

      Notes

      May seem lightly sporadic, but is more likely timing-based (i.e. SLEEP's etc. may help to reduce any light sporadicity).
      Both dbg+opt affected. -PS required. The specific PS table queried does not seem to matter. -
      The issue has been reproduced in the versions listed above, but not in 11.4, 11.5.

      Attachments

        Issue Links

          Activity

            People

              midenok Aleksey Midenkov
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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