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

Table corruption or Assertion `btr_validate_index(index, 0, false)' failed in row_upd_sec_index_entry with virtual column and EMPTY_STRING_IS_NULL SQL mode

    XMLWordPrintable

Details

    Description

      Notes:
      It looks like a variation of MDEV-18156, but MDEV-18156 patch is already in the trees, including 10.5, so it doesn't fix this one.
      The test case is admittedly degenerate, but I suppose there can be more complicated and more realistic ones based on the same idea.
      I've set 10.5 as an affected/fix version (contrary to our general approach of not mentioning development branches in affected/fix versions) to point out that 10.5 is indeed still affected, because MDEV-18156 was only fully fixed in 10.5.
      10.3/10.4 in the fix version field are tentative, but the same consideration applies to this as to MDEV-18156: if the fix requires a new limitation in common functionality, it's probably better not to do it in post-GA releases.

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (a INT, b BINARY(1) GENERATED ALWAYS AS (''), KEY(a,b)) ENGINE=InnoDB;
      INSERT INTO t1 (a) VALUES (1);
      SET SQL_MODE= 'EMPTY_STRING_IS_NULL';
      FLUSH TABLES;
      UPDATE t1 SET a = 2;
       
      # Cleanup
      DROP TABLE t1;
      

      10.5 3616175f

      2019-10-07  0:28:21 9 [ERROR] InnoDB: Record in index `a` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 3 fields): {[4]    (0x80000001),NULL,[6]      (0x000000000200)} at: COMPACT RECORD(info_bits=0, 1 fields): {[8]infimum (0x696E66696D756D00)}
      mysqld: /data/src/10.5/storage/innobase/row/row0upd.cc:2425: dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*): Assertion `btr_validate_index(index, 0)' failed.
      191007  0:28:21 [ERROR] mysqld got signal 6 ;
       
      #6  0x00007f4ab427ce67 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x559c3e88a925 "btr_validate_index(index, 0)", file=file@entry=0x559c3e88a188 "/data/src/10.5/storage/innobase/row/row0upd.cc", line=line@entry=2425, function=function@entry=0x559c3e88d080 <row_upd_sec_index_entry(upd_node_t*, que_thr_t*)::__PRETTY_FUNCTION__> "dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*)") at assert.c:92
      #7  0x00007f4ab427cf12 in __GI___assert_fail (assertion=0x559c3e88a925 "btr_validate_index(index, 0)", file=0x559c3e88a188 "/data/src/10.5/storage/innobase/row/row0upd.cc", line=2425, function=0x559c3e88d080 <row_upd_sec_index_entry(upd_node_t*, que_thr_t*)::__PRETTY_FUNCTION__> "dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*)") at assert.c:101
      #8  0x0000559c3e1b66d3 in row_upd_sec_index_entry (node=0x7f4a60106418, thr=0x7f4a60106720) at /data/src/10.5/storage/innobase/row/row0upd.cc:2425
      #9  0x0000559c3e1b6ece in row_upd_sec_step (node=0x7f4a60106418, thr=0x7f4a60106720) at /data/src/10.5/storage/innobase/row/row0upd.cc:2539
      #10 0x0000559c3e1b9e39 in row_upd (node=0x7f4a60106418, thr=0x7f4a60106720) at /data/src/10.5/storage/innobase/row/row0upd.cc:3315
      #11 0x0000559c3e1ba27f in row_upd_step (thr=0x7f4a60106720) at /data/src/10.5/storage/innobase/row/row0upd.cc:3430
      #12 0x0000559c3e15679e in row_update_for_mysql (prebuilt=0x7f4a60105c58) at /data/src/10.5/storage/innobase/row/row0mysql.cc:1889
      #13 0x0000559c3dfaefc8 in ha_innobase::update_row (this=0x7f4a60102ae8, old_row=0x7f4a60007558 "\375\001", new_row=0x7f4a60007550 "\375\002") at /data/src/10.5/storage/innobase/handler/ha_innodb.cc:8695
      #14 0x0000559c3dbb79f4 in handler::ha_update_row (this=0x7f4a60102ae8, old_data=0x7f4a60007558 "\375\001", new_data=0x7f4a60007550 "\375\002") at /data/src/10.5/sql/handler.cc:6675
      #15 0x0000559c3d983a2a in mysql_update (thd=0x7f4a60000b10, table_list=0x7f4a60013500, fields=..., values=..., conds=0x0, order_num=0, order=0x0, limit=18446744073709551615, ignore=false, found_return=0x7f4aad64e000, updated_return=0x7f4aad64e0c0) at /data/src/10.5/sql/sql_update.cc:1047
      #16 0x0000559c3d8660e8 in mysql_execute_command (thd=0x7f4a60000b10) at /data/src/10.5/sql/sql_parse.cc:4354
      #17 0x0000559c3d872f43 in mysql_parse (thd=0x7f4a60000b10, rawbuf=0x7f4a60013428 "UPDATE t1 SET a = 2", length=19, parser_state=0x7f4aad64e580, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:7938
      #18 0x0000559c3d85e521 in dispatch_command (command=COM_QUERY, thd=0x7f4a60000b10, packet=0x7f4a60093ec1 "UPDATE t1 SET a = 2", packet_length=19, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1845
      #19 0x0000559c3d85cc7b in do_command (thd=0x7f4a60000b10) at /data/src/10.5/sql/sql_parse.cc:1363
      #20 0x0000559c3d9fa9b1 in do_handle_one_connection (connect=0x559c40081640, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1422
      #21 0x0000559c3d9fa6e0 in handle_one_connection (arg=0x559c3ffe3270) at /data/src/10.5/sql/sql_connect.cc:1319
      #22 0x0000559c3df4153d in pfs_spawn_thread (arg=0x559c3ffe2ed0) at /data/src/10.5/storage/perfschema/pfs.cc:1862
      #23 0x00007f4ab5df24a4 in start_thread (arg=0x7f4aad64f700) at pthread_create.c:456
      #24 0x00007f4ab4339d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Non-debug build doesn't crash, but the error is still there:

      2019-10-07  0:39:53 9 [ERROR] InnoDB: Record in index `a` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 3 fields): {[4]    (0x80000001),NULL,[6]      (0x000000000200)} at: COMPACT RECORD(info_bits=0, 1 fields): {[8]infimum (0x696E66696D756D00)}
      

      And with MyISAM it's again, with debug and non-debug:

      mysqltest: At line 7: query 'UPDATE t1 SET a = 2' failed: 126: Index for table './test/t1.MYI' is corrupt; try to repair it
      

      Reproducible on 10.3+.
      The test case is not applicable to 10.2.

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.