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

Assertion `0' failed or `btr_validate_index(index, 0, false)' in row_upd_sec_index_entry or error code 126: Index is corrupted upon DELETE with PAD_CHAR_TO_FULL_LENGTH

Details

    Description

      Note: It might well be a duplicate of MDEV-18153, the results are exactly the same, but it's a different SQL_MODE (and thus different affected versions), and different table structures, so I'm filing it separately just in case.

      CREATE TABLE t1 (c CHAR(8), v BINARY(8) AS (c), KEY(v));
      INSERT INTO t1 (c) VALUES ('foo') ;
       
      SET SQL_MODE= 'PAD_CHAR_TO_FULL_LENGTH';
      DELETE FROM t1 WHERE c <> 'bar';
       
      # Cleanup
      DROP TABLE t1;
      

      10.2 0c20b247de with MyISAM

      mysqltest: At line 5: query 'DELETE FROM t1 WHERE c <> 'bar'' failed: 126: Index for table './test/t1.MYI' is corrupt; try to repair it
      

      10.2 debug 0c20b247de with InnoDB

      2019-01-06 22:02:13 140655082366720 [ERROR] InnoDB: Record in index `v` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]foo     (0x666F6F2020202020),[6]      (0x000000000200)} at: COMPACT RECORD(info_bits=0, 2 fields): {[8]foo     (0x666F6F0000000000),[6]      (0x000000000200)}
      mysqld: /data/src/10.2/storage/innobase/row/row0upd.cc:2436: dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*): Assertion `0' failed.
      190106 22:02:13 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fecd7f19ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x000055bf73ba59bb in row_upd_sec_index_entry (node=0x7fec88136de0, thr=0x7fec880848a8) at /data/src/10.2/storage/innobase/row/row0upd.cc:2436
      #9  0x000055bf73ba6031 in row_upd_sec_step (node=0x7fec88136de0, thr=0x7fec880848a8) at /data/src/10.2/storage/innobase/row/row0upd.cc:2549
      #10 0x000055bf73ba82b2 in row_upd (node=0x7fec88136de0, thr=0x7fec880848a8) at /data/src/10.2/storage/innobase/row/row0upd.cc:3308
      #11 0x000055bf73ba8603 in row_upd_step (thr=0x7fec880848a8) at /data/src/10.2/storage/innobase/row/row0upd.cc:3425
      #12 0x000055bf73b4ec37 in row_update_for_mysql (prebuilt=0x7fec881362d8) at /data/src/10.2/storage/innobase/row/row0mysql.cc:1830
      #13 0x000055bf73a1536b in ha_innobase::delete_row (this=0x7fec88135498, record=0x7fec880311d0 "\371foo     foo     ", '\245' <repeats 31 times>, "\030\022\003\210\354\177") at /data/src/10.2/storage/innobase/handler/ha_innodb.cc:9098
      #14 0x000055bf73709360 in handler::ha_delete_row (this=0x7fec88135498, buf=0x7fec880311d0 "\371foo     foo     ", '\245' <repeats 31 times>, "\030\022\003\210\354\177") at /data/src/10.2/sql/handler.cc:6021
      #15 0x000055bf73898cb4 in mysql_delete (thd=0x7fec88000b00, table_list=0x7fec88012530, conds=0x7fec88012ce8, order_list=0x7fec88005078, limit=18446744073709551615, options=0, result=0x0) at /data/src/10.2/sql/sql_delete.cc:583
      #16 0x000055bf73484616 in mysql_execute_command (thd=0x7fec88000b00) at /data/src/10.2/sql/sql_parse.cc:4636
      #17 0x000055bf7348ef51 in mysql_parse (thd=0x7fec88000b00, rawbuf=0x7fec88012448 "DELETE FROM t1 WHERE c <> 'bar'", length=31, parser_state=0x7fecd0385200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:8015
      #18 0x000055bf7347c88b in dispatch_command (command=COM_QUERY, thd=0x7fec88000b00, packet=0x7fec88096261 "DELETE FROM t1 WHERE c <> 'bar'", packet_length=31, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1826
      #19 0x000055bf7347b1e2 in do_command (thd=0x7fec88000b00) at /data/src/10.2/sql/sql_parse.cc:1379
      #20 0x000055bf735cdccd in do_handle_one_connection (connect=0x55bf772692d0) at /data/src/10.2/sql/sql_connect.cc:1335
      #21 0x000055bf735cda5a in handle_one_connection (arg=0x55bf772692d0) at /data/src/10.2/sql/sql_connect.cc:1241
      #22 0x000055bf739f397c in pfs_spawn_thread (arg=0x55bf771af6d0) at /data/src/10.2/storage/perfschema/pfs.cc:1862
      #23 0x00007fecd9bf0494 in start_thread (arg=0x7fecd0386700) at pthread_create.c:333
      #24 0x00007fecd7fd693f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      10.2 non-debug 0c20b247de with InnoDB

      2019-01-06 22:03:36 140321956206336 [ERROR] InnoDB: Record in index `v` of table `test`.`t1` was not found on update: TUPLE (info_bits=0, 2 fields): {[8]foo     (0x666F6F2020202020),[6]      (0x000000000200)} at: COMPACT RECORD(info_bits=0, 2 fields): {[8]foo     (0x666F6F0000000000),[6]      (0x000000000200)}
      

      Attachments

        Issue Links

          Activity

            bar Alexander Barkov added a comment - - edited serg , please review a new version: https://github.com/MariaDB/server/commit/e4415549e5374f6fcb5d317a7078ead610adfa6c

            This patch is good, basically ok to push. But it makes old tables unreadable (an error when a table is opened).

            We need some reasonable user-friendly behavior on upgrades. In a separate patch, yes. But both have to be pushed together, otherwise we risk that the first patch will be released alone and the second patch won't make it.

            serg Sergei Golubchik added a comment - This patch is good, basically ok to push. But it makes old tables unreadable (an error when a table is opened). We need some reasonable user-friendly behavior on upgrades. In a separate patch, yes. But both have to be pushed together, otherwise we risk that the first patch will be released alone and the second patch won't make it.

            serg, please find an additional patch here:
            https://github.com/MariaDB/server/commit/899c0b3ec6e609e34b217e1f35e3c07a901e4a92

            It allows to open old tables for most purposes, only creation of "bad" virtual fields is now disallowed.

            Note, automatic fixing, like adding RTRIM()/RPAD(), is not implemented yet.

            Thanks.

            bar Alexander Barkov added a comment - serg , please find an additional patch here: https://github.com/MariaDB/server/commit/899c0b3ec6e609e34b217e1f35e3c07a901e4a92 It allows to open old tables for most purposes, only creation of "bad" virtual fields is now disallowed. Note, automatic fixing, like adding RTRIM()/RPAD(), is not implemented yet. Thanks.

            ok to push

            serg Sergei Golubchik added a comment - ok to push

            For the record, despite having a long history, I think it ended up only fixed in 10.5, as the fix wasn't acceptable for post-GA versions. But there were several commits in all branches, so I'm not sure what is the correct value for fixVersion.

            elenst Elena Stepanova added a comment - For the record, despite having a long history, I think it ended up only fixed in 10.5, as the fix wasn't acceptable for post-GA versions. But there were several commits in all branches, so I'm not sure what is the correct value for fixVersion.

            People

              bar Alexander Barkov
              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.