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

InnoDB Data corruption and Assertion `0' failed in row_upd_sec_index_entry upon DELETE

Details

    Description

      Creating as seperate ticket from MDEV-22759 as the versions (and testcase to a given extent) are different.

      --source include/have_innodb.inc
      CREATE TABLE t1 (DATA CHAR(4),UNIQUE (DATA) USING HASH) ENGINE=InnoDB WITH SYSTEM VERSIONING;
      INSERT INTO t1 VALUES (0);
      DELETE FROM t1;
      DELETE HISTORY FROM t1;
      

      Leads to:

      CS 11.2.6 12a91b57e27b979819924cf89614e6e51f24b37b (Debug)

      2024-10-17 15:27:56 0 [Note] /test/MD141024-mariadb-11.2.6-linux-x86_64-dbg/bin/mariadbd: ready for connections.
      Version: '11.2.6-MariaDB-debug-log'  socket: '/test/MD141024-mariadb-11.2.6-linux-x86_64-dbg/mariadb-test/var/tmp/mysqld.1.sock'  port: 19000  MariaDB Server
      2024-10-17 15:27:56 4 [ERROR] InnoDB: Record in index `DATA` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]    0| )(0x00000000307CDE29),[6]      (0x000000000001)} at: COMPACT RECORD(info_bits=0, 2 fields): {[8]        (0x0000000019B3C197),[6]      (0x000000000001)}
      mariadbd: /test/11.2_dbg/storage/innobase/row/row0upd.cc:1909: dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*): Assertion `0' failed.
      

      CS 11.2.6 12a91b57e27b979819924cf89614e6e51f24b37b (Debug)

      Core was generated by `/test/MD141024-mariadb-11.2.6-linux-x86_64-dbg/bin/mariadbd --defaults-group-su'.
      Program terminated with signal SIGABRT, Aborted.
      Download failed: Invalid argument.  Continuing without source file ./nptl/./nptl/pthread_kill.c.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
       
      [Current thread is 1 (LWP 3859336)]
      (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  0x0000147be084526e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x0000147be08288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x0000147be082881b in __assert_fail_base (fmt=0x147be09d01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55e999ec7150 "0", file=file@entry=0x55e999e28e18 "/test/11.2_dbg/storage/innobase/row/row0upd.cc", line=line@entry=1909, function=function@entry=0x55e999e29f08 "dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*)") at ./assert/assert.c:94
      #6  0x0000147be083b507 in __assert_fail (assertion=0x55e999ec7150 "0", file=0x55e999e28e18 "/test/11.2_dbg/storage/innobase/row/row0upd.cc", line=1909, function=0x55e999e29f08 "dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*)") at ./assert/assert.c:103
      #7  0x000055e99986e4b6 in row_upd_sec_index_entry (node=node@entry=0x147b9c103030, thr=thr@entry=0x147b9c1ff428)at /test/11.2_dbg/storage/innobase/row/row0upd.cc:1909
      #8  0x000055e999870e4f in row_upd_sec_step (thr=0x147b9c1ff428, node=0x147b9c103030) at /test/11.2_dbg/storage/innobase/row/row0upd.cc:2036
      #9  row_upd (thr=0x147b9c1ff428, node=0x147b9c103030)at /test/11.2_dbg/storage/innobase/row/row0upd.cc:2783
      #10 row_upd_step (thr=thr@entry=0x147b9c1ff428)at /test/11.2_dbg/storage/innobase/row/row0upd.cc:2898
      #11 0x000055e9998102c9 in row_update_for_mysql (prebuilt=0x147b9c102568)at /test/11.2_dbg/storage/innobase/row/row0mysql.cc:1658
      #12 0x000055e999667386 in ha_innobase::delete_row (this=0x147b9c101cb0, record=0x147b9c22d0f8 "\3710   g\020\222L\016&Kg\020\222L\016)\201)\336|0")at /test/11.2_dbg/storage/innobase/handler/ha_innodb.cc:8726
      #13 0x000055e9992fb7ca in handler::ha_delete_row (this=0x147b9c101cb0, buf=0x147b9c22d0f8 "\3710   g\020\222L\016&Kg\020\222L\016)\201)\336|0")at /test/11.2_dbg/sql/handler.cc:8080
      #14 0x000055e998f88f4f in TABLE::delete_row (this=this@entry=0x147b9c231028)at /test/11.2_dbg/sql/sql_delete.cc:295
      #15 0x000055e998f86651 in Sql_cmd_delete::delete_from_single_table (this=this@entry=0x147b9c015858, thd=thd@entry=0x147b9c000d58)at /test/11.2_dbg/sql/sql_delete.cc:846
      #16 0x000055e998f8752a in Sql_cmd_delete::execute_inner (this=0x147b9c015858, thd=0x147b9c000d58) at /test/11.2_dbg/sql/sql_delete.cc:1827
      #17 0x000055e99901e897 in Sql_cmd_dml::execute (this=0x147b9c015858, thd=0x147b9c000d58) at /test/11.2_dbg/sql/sql_select.cc:34268
      #18 0x000055e998fda92c in mysql_execute_command (thd=thd@entry=0x147b9c000d58, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false)at /test/11.2_dbg/sql/sql_parse.cc:4433
      #19 0x000055e998fe02ce in mysql_parse (thd=thd@entry=0x147b9c000d58, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x147bdb7fe2a0)at /test/11.2_dbg/sql/sql_parse.cc:7938
      #20 0x000055e998fe2786 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x147b9c000d58, packet=packet@entry=0x147b9c00b3b9 "DELETE HISTORY FROM t1", packet_length=packet_length@entry=22, blocking=blocking@entry=true)at /test/11.2_dbg/sql/sql_class.h:248
      #21 0x000055e998fe49c2 in do_command (thd=0x147b9c000d58, blocking=blocking@entry=true) at /test/11.2_dbg/sql/sql_parse.cc:1407
      #22 0x000055e999151fe7 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55e99c835a58, put_in_cache=put_in_cache@entry=true)at /test/11.2_dbg/sql/sql_connect.cc:1439
      #23 0x000055e9991522ef in handle_one_connection (arg=arg@entry=0x55e99c835a58)at /test/11.2_dbg/sql/sql_connect.cc:1341
      #24 0x000055e999599f14 in pfs_spawn_thread (arg=0x55e99c7b17d8)at /test/11.2_dbg/storage/perfschema/pfs.cc:2201
      #25 0x0000147be089ca94 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #26 0x0000147be0929c3c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Confirmed in current debug + release builds 10.11 to 11.7:

      /test/MD141024-mariadb-10.11.10-linux-x86_64-dbg/mysql-test/var/log/mysqld.1.err:2024-10-17 15:30:05 4 [ERROR] InnoDB: Record in index `DATA` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]        (0x00000000C7C414F6),[6]      (0x000000000200)} at: COMPACT RECORD(info_bits=0, 2 fields): {[8]        (0x0000000019B3C197),[6]      (0x000000000200)}
      /test/MD141024-mariadb-10.11.10-linux-x86_64-opt/mysql-test/var/log/mysqld.1.err:2024-10-17 15:30:13 4 [ERROR] InnoDB: Record in index `DATA` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]    l   (0x000000006C94C80B),[6]      (0x000000000200)} at: COMPACT RECORD(info_bits=0, 2 fields): {[8]        (0x0000000019B3C197),[6]      (0x000000000200)}
      /test/MD141024-mariadb-11.2.6-linux-x86_64-dbg/mariadb-test/var/log/mysqld.1.err:2024-10-17 15:30:27 4 [ERROR] InnoDB: Record in index `DATA` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]     @ {(0x000000008A400A7B),[6]      (0x000000000001)} at: COMPACT RECORD(info_bits=0, 2 fields): {[8]        (0x0000000019B3C197),[6]      (0x000000000001)}
      /test/MD141024-mariadb-11.2.6-linux-x86_64-opt/mariadb-test/var/log/mysqld.1.err:2024-10-17 15:30:35 4 [ERROR] InnoDB: Record in index `DATA` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]    \  {(0x000000005CC7087B),[6]      (0x000000000001)} at: COMPACT RECORD(info_bits=0, 2 fields): {[8]        (0x0000000019B3C197),[6]      (0x000000000001)}
      /test/MD141024-mariadb-11.4.4-linux-x86_64-dbg/mariadb-test/var/log/mysqld.1.err:2024-10-17 15:30:38 4 [ERROR] InnoDB: Record in index `DATA` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]        (0x000000009AF7889B),[6]      (0x000000000001)} at: COMPACT RECORD(info_bits=0, 2 fields): {[8]        (0x0000000019B3C197),[6]      (0x000000000001)}
      /test/MD141024-mariadb-11.4.4-linux-x86_64-opt/mariadb-test/var/log/mysqld.1.err:2024-10-17 15:30:47 4 [ERROR] InnoDB: Record in index `DATA` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]    Y   (0x0000000059CB1380),[6]      (0x000000000001)} at: COMPACT RECORD(info_bits=0, 2 fields): {[8]        (0x0000000019B3C197),[6]      (0x000000000001)}
      /test/MD141024-mariadb-11.6.2-linux-x86_64-dbg/mariadb-test/var/log/mysqld.1.err:2024-10-17 15:30:50 4 [ERROR] InnoDB: Record in index `DATA` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]      x (0x00000000F99F78D9),[6]      (0x000000000001)} at: COMPACT RECORD(info_bits=0, 2 fields): {[8]     n  (0x00000000F66EAC90),[6]      (0x000000000001)}
      /test/MD141024-mariadb-11.6.2-linux-x86_64-opt/mariadb-test/var/log/mysqld.1.err:2024-10-17 15:30:59 4 [ERROR] InnoDB: Record in index `DATA` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]     6sd(0x0000000014367364),[6]      (0x000000000001)} at: COMPACT RECORD(info_bits=0, 1 fields): {[8]infimum (0x696E66696D756D00)}
      /test/MD141024-mariadb-11.7.0-linux-x86_64-dbg/mariadb-test/var/log/mysqld.1.err:2024-10-17 15:31:02 4 [ERROR] InnoDB: Record in index `DATA` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]      M (0x0000000093854D9D),[6]      (0x000000000001)} at: COMPACT RECORD(info_bits=0, 1 fields): {[8]infimum (0x696E66696D756D00)}
      /test/MD141024-mariadb-11.7.0-linux-x86_64-opt/mariadb-test/var/log/mysqld.1.err:2024-10-17 15:31:11 4 [ERROR] InnoDB: Record in index `DATA` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]        (0x0000000011BEB9B2),[6]      (0x000000000001)} at: COMPACT RECORD(info_bits=0, 1 fields): {[8]infimum (0x696E66696D756D00)}
      

      Notice the small differences between versions.

      Attachments

        Issue Links

          Activity

            If t1 is MyISAM, we also see corruption:

            CS 11.2.6 12a91b57e27b979819924cf89614e6e51f24b37b (Debug)

            11.2.6-dbg>DELETE HISTORY FROM t1;
            ERROR 126 (HY000): Index for table './test/t1.MYI' is corrupt; try to repair it
            

            CS 11.2.6 12a91b57e27b979819924cf89614e6e51f24b37b (Debug)

            2024-10-17 15:42:19 4 [ERROR] mariadbd: Index for table './test/t1.MYI' is corrupt; try to repair it
            2024-10-17 15:42:19 4 [ERROR] mariadbd: Index for table './test/t1.MYI' is corrupt; try to repair it
            2024-10-17 15:42:19 4 [ERROR] Got an error from thread_id=4, /test/11.2_dbg/storage/myisam/mi_delete.c:121
            2024-10-17 15:42:19 4 [ERROR] MariaDB thread id 4, OS thread handle 22538513032896, query id 6 localhost root Updating
            DELETE HISTORY FROM t1
            2024-10-17 15:42:19 4 [ERROR] MariaDB thread id 4, OS thread handle 22538513032896, query id 6 localhost root Updating
            DELETE HISTORY FROM t1
            2024-10-17 15:42:19 4 [ERROR] mariadbd: Index for table 't1' is corrupt; try to repair it
            

            Roel Roel Van de Paar added a comment - If t1 is MyISAM, we also see corruption: CS 11.2.6 12a91b57e27b979819924cf89614e6e51f24b37b (Debug) 11.2.6-dbg>DELETE HISTORY FROM t1; ERROR 126 (HY000): Index for table './test/t1.MYI' is corrupt; try to repair it CS 11.2.6 12a91b57e27b979819924cf89614e6e51f24b37b (Debug) 2024-10-17 15:42:19 4 [ERROR] mariadbd: Index for table './test/t1.MYI' is corrupt; try to repair it 2024-10-17 15:42:19 4 [ERROR] mariadbd: Index for table './test/t1.MYI' is corrupt; try to repair it 2024-10-17 15:42:19 4 [ERROR] Got an error from thread_id=4, /test/11.2_dbg/storage/myisam/mi_delete.c:121 2024-10-17 15:42:19 4 [ERROR] MariaDB thread id 4, OS thread handle 22538513032896, query id 6 localhost root Updating DELETE HISTORY FROM t1 2024-10-17 15:42:19 4 [ERROR] MariaDB thread id 4, OS thread handle 22538513032896, query id 6 localhost root Updating DELETE HISTORY FROM t1 2024-10-17 15:42:19 4 [ERROR] mariadbd: Index for table 't1' is corrupt; try to repair it

            If it is USING HASH caused please assign both tasks to USING HASH developer and link them with Duplicates relation.

            midenok Aleksey Midenkov added a comment - If it is USING HASH caused please assign both tasks to USING HASH developer and link them with Duplicates relation.

            Yes the issue only reproduces with USING HASH, however the versions differ. bar Hi! If this is not for you, please re-assign as needed. Thank you

            Roel Roel Van de Paar added a comment - Yes the issue only reproduces with USING HASH, however the versions differ. bar Hi! If this is not for you, please re-assign as needed. Thank you

            Also please test wtih:

            --source include/have_innodb.inc
            CREATE TABLE t (c INT,UNIQUE (c) USING HASH) ENGINE=InnoDB WITH SYSTEM VERSIONING;
            INSERT INTO t VALUES (0);
            DELETE FROM t;
            DELETE HISTORY FROM t;
            

            Roel Roel Van de Paar added a comment - Also please test wtih: --source include/have_innodb.inc CREATE TABLE t (c INT , UNIQUE (c) USING HASH) ENGINE=InnoDB WITH SYSTEM VERSIONING; INSERT INTO t VALUES (0); DELETE FROM t; DELETE HISTORY FROM t;

            People

              midenok Aleksey Midenkov
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.