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

Replica index corruption and InnoDB: Failing assertion: !cursor->index->is_committed() in row_ins_sec_index_entry_by_modify when using generated columns

    XMLWordPrintable

Details

    Description

      Unlike MDEV-22759, no USING HASH not SYSTEM VERSIONING is used here

      CREATE DATABASE test2;
      SET sql_mode=0,binlog_row_image=1;
      CREATE TABLE t (a INT,b INT,PRIMARY KEY(a)) ENGINE=InnoDB;
      ALTER TABLE t ADD COLUMN x1 BLOB GENERATED ALWAYS AS (CONCAT (a,b)) VIRTUAL,ADD COLUMN x2 BLOB GENERATED ALWAYS AS (CONCAT (a,b)) VIRTUAL,ADD INDEX (x1 (1),x2 (1));  
      USE test2;
      CREATE TEMPORARY TABLE t (a INT) ENGINE=InnoDB;
      USE test;
      INSERT INTO t VALUES (2,2,2,2);
      SELECT * FROM performance_schema.file_summary_by_instance LIMIT 1;
      UPDATE t SET b=0;
      

      Leads to index corruption and assert !cursor->index->is_committed() on the replica :

      10.5.26 4911ec1a5bc07ef20c9018386a3a2671c59c4dca (Optimized)

      2024-06-10  8:24:25 5 [Note] Slave I/O thread: connected to master 'repl_user@127.0.0.1:12796',replication starts at GTID position ''
      2024-06-10  8:24:27 6 [ERROR] InnoDB: Record in index `x1` of table `test`.`t` was not found on update: TUPLE (info_bits=0, 3 fields): {NULL,NULL,[4]    (0x80000002)} at: COMPACT RECORD(info_bits=0, 1 fields): {[8]infimum (0x696E66696D756D00)}
      2024-06-10 08:24:27 0x14b9208cf6c0  InnoDB: Assertion failure in file /test/10.5_opt/storage/innobase/row/row0ins.cc line 219
      InnoDB: Failing assertion: !cursor->index->is_committed()
      

      10.5.26 4911ec1a5bc07ef20c9018386a3a2671c59c4dca (Optimized)

      Core was generated by `/test/MD170524-mariadb-10.5.26-linux-x86_64-opt/bin/mariadbd --no-defaults --ma'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
      Download failed: Invalid argument.  Continuing without source file ./nptl/./nptl/pthread_kill.c.
      [Current thread is 1 (LWP 851874)]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)at ./nptl/pthread_kill.c:89
      #3  0x000014b936042866 in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x000014b9360268b7 in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000056154b7bf16a in ut_dbg_assertion_failed (expr=expr@entry=0x56154c410228 "!cursor->index->is_committed()", file=file@entry=0x56154c40fd78 "/test/10.5_opt/storage/innobase/row/row0ins.cc", line=line@entry=219) at /test/10.5_opt/storage/innobase/ut/ut0dbg.cc:60
      #6  0x000056154b7a7efb in row_ins_sec_index_entry_by_modify (mtr=0x14b9208cd130, thr=0x14b88803b960, entry=0x14b88803dc80, heap=0x14b88803e538, offsets_heap=<optimized out>, offsets=0x14b9208cc1d0, cursor=0x14b9208cc240, mode=2, flags=0)at /test/10.5_opt/storage/innobase/row/row0ins.cc:219
      #7  row_ins_sec_index_entry_low (flags=flags@entry=0, mode=<optimized out>, mode@entry=2, index=index@entry=0x14b88801d460, offsets_heap=<optimized out>, offsets_heap@entry=0x14b88803e0a8, heap=heap@entry=0x14b88803e538, entry=entry@entry=0x14b88803dc80, trx_id=<optimized out>, thr=<optimized out>)at /test/10.5_opt/storage/innobase/row/row0ins.cc:3147
      #8  0x000056154bf42213 in row_ins_sec_index_entry (index=index@entry=0x14b88801d460, entry=entry@entry=0x14b88803dc80, thr=thr@entry=0x14b88803b960, check_foreign=<optimized out>)at /test/10.5_opt/storage/innobase/row/row0ins.cc:3358
      #9  0x000056154bf7cfe8 in row_upd_sec_index_entry (node=node@entry=0x14b888037828, thr=thr@entry=0x14b88803b960)at /test/10.5_opt/storage/innobase/row/row0upd.cc:2237
      #10 0x000056154bf7dbe7 in row_upd_sec_step (thr=<optimized out>, node=0x14b888037828) at /test/10.5_opt/storage/innobase/row/row0upd.cc:2264
      #11 row_upd (thr=0x14b88803b960, node=0x14b888037828)at /test/10.5_opt/storage/innobase/row/row0upd.cc:3051
      #12 row_upd_step (thr=thr@entry=0x14b88803b960)at /test/10.5_opt/storage/innobase/row/row0upd.cc:3166
      #13 0x000056154bf55bc3 in row_update_for_mysql (prebuilt=0x14b888036d60)at /test/10.5_opt/storage/innobase/row/row0mysql.cc:1802
      #14 0x000056154be88169 in ha_innobase::update_row (this=0x14b888034670, old_row=0x14b8880300b8 "\376\002", new_row=0x14b888030098 "\370\002")at /test/10.5_opt/storage/innobase/handler/ha_innodb.cc:8481
      #15 0x000056154bb51b5a in handler::ha_update_row (this=0x14b888034670, old_data=0x14b8880300b8 "\376\002", new_data=0x14b888030098 "\370\002")at /test/10.5_opt/sql/handler.cc:7415
      #16 0x000056154bc770b9 in Update_rows_log_event::do_exec_row (this=0x56154e445588, rgi=0x14b888000c50)at /test/10.5_opt/sql/log_event_server.cc:8487
      #17 0x000056154bc699d6 in Rows_log_event::do_apply_event (this=0x56154e445588, rgi=0x14b888000c50) at /test/10.5_opt/sql/log_event_server.cc:5749
      #18 0x000056154b840186 in Log_event::apply_event (rgi=0x14b888000c50, this=<optimized out>) at /test/10.5_opt/sql/log_event.h:1492
      #19 apply_event_and_update_pos_apply (ev=ev@entry=0x56154e445588, thd=thd@entry=0x14b888001568, rgi=rgi@entry=0x14b888000c50, reason=<optimized out>) at /test/10.5_opt/sql/slave.cc:3873
      #20 0x000056154b8488b8 in apply_event_and_update_pos (ev=ev@entry=0x56154e445588, thd=thd@entry=0x14b888001568, rgi=rgi@entry=0x14b888000c50) at /test/10.5_opt/sql/slave.cc:4045
      #21 0x000056154b849945 in exec_relay_log_event (serial_rgi=<optimized out>, rli=<optimized out>, thd=0x14b888001568)at /test/10.5_opt/sql/slave.cc:4413
      #22 handle_slave_sql (arg=arg@entry=0x56154e499330)at /test/10.5_opt/sql/slave.cc:5630
      #23 0x000056154bdcb167 in pfs_spawn_thread (arg=0x14b890022248)at /test/10.5_opt/storage/perfschema/pfs.cc:2201
      #24 0x000014b936097ada in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:444
      #25 0x000014b93612847c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      10.6 Does not assert but does show corruption:

      10.6.19 9a95f6b53b44a8be64817b92bb56423c6fad5a0d (Optimized)

      2024-06-10  8:30:51 5 [Note] Slave I/O thread: connected to master 'repl_user@127.0.0.1:10794',replication starts at GTID position ''
      2024-06-10  8:31:33 6 [ERROR] InnoDB: Record in index `x1` of table `test`.`t` was not found on update: TUPLE (info_bits=0, 3 fields): {NULL,NULL,[4]    (0x80000002)} at: COMPACT RECORD(info_bits=0, 1 fields): {[8]infimum (0x696E66696D756D00)}
      2024-06-10  8:31:33 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-06-10  8:31:33 6 [Warning] InnoDB: Record in index `x1` of table `test`.`t` was not found on rollback, trying to insert: TUPLE (info_bits=0, 3 fields): {NULL,NULL,[4]    (0x80000002)} at: COMPACT RECORD(info_bits=0, 1 fields): {[8]infimum (0x696E66696D756D00)}
      2024-06-10  8:31:33 6 [ERROR] mariadbd: Index for table 't' is corrupt; try to repair it
      2024-06-10  8:31:33 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 1980, Gtid 0-1-9, Internal MariaDB error code: 1034
      2024-06-10  8:31:33 6 [Warning] Slave: Index for table 't' is corrupt; try to repair it Error_code: 1034
      2024-06-10  8:31:33 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 1790; GTID position '0-1-8'
      2024-06-10  8:31:33 6 [Note] Slave SQL thread exiting, replication stopped in log 'binlog.000001' at position 1790; GTID position '0-1-8', master: 127.0.0.1:10794
      

      On debug we see the:

      10.6.19 9a95f6b53b44a8be64817b92bb56423c6fad5a0d (Debug)

      2024-06-10  9:41:45 6 [ERROR] InnoDB: Record in index `x1` of table `test`.`t` was not found on update: TUPLE (info_bits=0, 3 fields): {NULL,NULL,[4]    (0x80000002)} at: COMPACT RECORD(info_bits=0, 1 fields): {[8]infimum (0x696E66696D756D00)}
      mariadbd: /test/10.6_dbg/storage/innobase/row/row0upd.cc:1931: dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*): Assertion `0' failed.
      

      Likely caused by MDEV-371. Happens on RBR and MBR but not SBR. Affect tests as it may mask other replica index corruption bugs.

      Attachments

        Issue Links

          Activity

            People

              nikitamalyavin Nikita Malyavin
              Roel Roel Van de Paar
              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.