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

Index corruption with DESC part in unique key and nopad collation

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.8, 10.9, 10.10
    • Fix Version/s: 10.8, 10.9, 10.10
    • Component/s: Server
    • Labels:
      None

      Description

      --source include/have_innodb.inc
       
      CREATE TABLE t (id INT PRIMARY KEY, b VARCHAR(8), c CHAR(4), UNIQUE(b DESC,c)) COLLATE utf8_nopad_bin;
      INSERT INTO t VALUES (1,UNHEX('00010203'),'a'),(2,'','b'),(3,UNHEX('00020201'),'c');
      REPLACE INTO t SELECT id, b, c FROM t;
       
      # Cleanup
      DROP TABLE t;
      

      With MyISAM for the table engine:

      10.8 d6d8a499

      query 'REPLACE INTO t SELECT id, b, c FROM t' failed: HA_ERR_CRASHED (126): Index for table './test/t.MYI' is corrupt; try to repair it
      

      With Aria:

      query 'REPLACE INTO t SELECT id, b, c FROM t' failed: HA_ERR_CRASHED (126): Got error '126 "Index is corrupted"' for './test/t.MAI'
      

      With InnoDB:

      2022-11-09 21:23:43 4 [ERROR] InnoDB: Record in index `b` of table `test`.`t` was not found on update: TUPLE (info_bits=0, 3 fields): {[0](0x),[4]b   (0x62202020),[4]    (0x80000002)} at: COMPACT RECORD(info_bits=0, 1 fields): {[8]infimum (0x696E66696D756D00)}
      mariadbd: /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/row/row0upd.cc:1930: dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*): Assertion `0' failed.
      221109 21:23:43 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f43e9aee662 in __GI___assert_fail (assertion=0x55e26c78d1e0 "0", file=0x55e26c794700 "/home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/row/row0upd.cc", line=1930, function=0x55e26c796340 "dberr_t row_upd_sec_index_entry(upd_node_t*, que_thr_t*)") at assert.c:101
      #8  0x000055e26b27066d in row_upd_sec_index_entry (node=0x620000014c38, thr=0x6240000f01a0) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/row/row0upd.cc:1930
      #9  0x000055e26b271632 in row_upd_sec_step (node=0x620000014c38, thr=0x6240000f01a0) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/row/row0upd.cc:2055
      #10 0x000055e26b27671b in row_upd (node=0x620000014c38, thr=0x6240000f01a0) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/row/row0upd.cc:2779
      #11 0x000055e26b277200 in row_upd_step (thr=0x6240000f01a0) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/row/row0upd.cc:2894
      #12 0x000055e26b1cca32 in row_update_for_mysql (prebuilt=0x620000014120) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/row/row0mysql.cc:1690
      #13 0x000055e26ae1f357 in ha_innobase::delete_row (this=0x61d0002d5ab8, record=0x6190000ee7f8 "\274\002") at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/innobase/handler/ha_innodb.cc:8707
      #14 0x000055e26a4b6727 in handler::ha_delete_row (this=0x61d0002d5ab8, buf=0x6190000ee7f8 "\274\002") at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/handler.cc:7698
      #15 0x000055e269b20f6d in write_record (thd=0x62b00017a218, table=0x6190000ee298, info=0x62900010b388, sink=0x0) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_insert.cc:2141
      #16 0x000055e269b32444 in select_insert::send_data (this=0x62900010b338, values=...) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_insert.cc:4170
      #17 0x000055e269db34fd in select_result_sink::send_data_with_check (this=0x62900010b338, items=..., u=0x62b00017e630, sent=2) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_class.h:5689
      #18 0x000055e269d6f5c1 in end_send (join=0x62900010b400, join_tab=0x6290002da998, end_of_records=false) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_select.cc:22574
      #19 0x000055e269d67763 in evaluate_join_record (join=0x62900010b400, join_tab=0x6290002da5e8, error=0) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_select.cc:21568
      #20 0x000055e269da4e2f in AGGR_OP::end_send (this=0x62900010ce00) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_select.cc:29799
      #21 0x000055e269d64e71 in sub_select_postjoin_aggr (join=0x62900010b400, join_tab=0x6290002da5e8, end_of_records=true) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_select.cc:21046
      #22 0x000055e269d657c5 in sub_select (join=0x62900010b400, join_tab=0x6290002da238, end_of_records=true) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_select.cc:21281
      #23 0x000055e269d6418a in do_select (join=0x62900010b400, procedure=0x0) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_select.cc:20883
      #24 0x000055e269cf1367 in JOIN::exec_inner (this=0x62900010b400) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_select.cc:4791
      #25 0x000055e269cee87b in JOIN::exec (this=0x62900010b400) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_select.cc:4569
      #26 0x000055e269cf2c9c in mysql_select (thd=0x62b00017a218, tables=0x62900010a328, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2202244745984, result=0x62900010b338, unit=0x62b00017e630, select_lex=0x629000109a78) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_select.cc:5049
      #27 0x000055e269cc325b in handle_select (thd=0x62b00017a218, lex=0x62b00017e558, result=0x62900010b338, setup_tables_done_option=1073741824) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_select.cc:552
      #28 0x000055e269be2055 in mysql_execute_command (thd=0x62b00017a218, is_called_from_prepared_stmt=false) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_parse.cc:4709
      #29 0x000055e269bf8b05 in mysql_parse (thd=0x62b00017a218, rawbuf=0x629000109238 "REPLACE INTO t SELECT id, b, c FROM t", length=37, parser_state=0x7f43da699990) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_parse.cc:8014
      #30 0x000055e269bcf4ab in dispatch_command (command=COM_QUERY, thd=0x62b00017a218, packet=0x62900028f219 "REPLACE INTO t SELECT id, b, c FROM t", packet_length=37, blocking=true) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_parse.cc:1894
      #31 0x000055e269bcc27e in do_command (thd=0x62b00017a218, blocking=true) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_parse.cc:1407
      #32 0x000055e26a0656f6 in do_handle_one_connection (connect=0x6080000032b8, put_in_cache=true) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_connect.cc:1416
      #33 0x000055e26a06508c in handle_one_connection (arg=0x608000003238) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/sql/sql_connect.cc:1318
      #34 0x000055e26ac2ffdc in pfs_spawn_thread (arg=0x617000007418) at /home/jenkins/workspace/sandbox-elenst/Nightly-Build-CS/src/storage/perfschema/pfs.cc:2201
      #35 0x00007f43e9fccea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #36 0x00007f43e9bb9aef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Reproducible on 10.8-10.10, started happening on 10.8 after this commit:

      commit a4cac0e07ad7f0909be3f66676e800e20c6b9fa8 (HEAD)
      Author: Sergei Golubchik
      Date:   Wed Nov 24 16:50:21 2021 +0100
       
          MDEV-26938 Support descending indexes internally in InnoDB (server part)
      

        Attachments

          Issue Links

            Activity

              People

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