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

Aria table key read crash because wrong index used

    XMLWordPrintable

Details

    Description

      Server crashes in _ma_keylength_part or Assertion `info->last_key.keyinfo == key->keyinfo' failed in _ma_search_no_save

      Note: I'm not sure it's related to versioning, but I couldn't modify the test case to avoid it.

      --source include/have_partition.inc
       
      CREATE TABLE t1 (
          a INT NOT NULL AUTO_INCREMENT,
          b INT,
          c CHAR,
          PRIMARY KEY (b),
          UNIQUE(b),
          KEY(c,a)
      ) ENGINE=Aria WITH SYSTEM VERSIONING
       PARTITION BY SYSTEM_TIME INTERVAL 1 HOUR (
          PARTITION p1 HISTORY,
          PARTITION pn CURRENT
      );
      ALTER TABLE t1 DROP PRIMARY KEY;
      REPLACE INTO t1 VALUES (1,0,''),(2,0,''),(0,0,'');
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 non-debug ba679ae52

      #3  <signal handler called>
      #4  0x000055850e58c7d9 in _ma_keylength_part (keyinfo=keyinfo@entry=0x7f6cb008eca0, key=0x7f6cb01993db <error: Cannot access memory at address 0x7f6cb01993db>, end=0x7f6cb008eda0) at /data/src/10.4/storage/maria/ma_search.c:1626
      #5  0x000055850e58996c in maria_rkey (info=0x7f6cb00346a8, buf=buf@entry=0x7f6cb011dfc0 "\375\002", inx=inx@entry=0, key_data=<optimized out>, keypart_map=<optimized out>, search_flag=HA_READ_KEY_EXACT) at /data/src/10.4/storage/maria/ma_rkey.c:200
      #6  0x000055850e55f2f4 in ha_maria::index_read_idx_map (this=0x7f6cb00c61a0, buf=0x7f6cb011dfc0 "\375\002", index=0, key=<optimized out>, keypart_map=<optimized out>, find_flag=<optimized out>) at /data/src/10.4/storage/maria/ha_maria.cc:2377
      #7  0x000055850e1e8c9a in handler::ha_index_read_idx_map (this=0x7f6cb00c61a0, buf=buf@entry=0x7f6cb011dfc0 "\375\002", index=index@entry=0, key=key@entry=0x7f6cc2b72720 "", keypart_map=keypart_map@entry=3, find_flag=find_flag@entry=HA_READ_KEY_EXACT) at /data/src/10.4/sql/handler.cc:2914
      #8  0x000055850e641565 in ha_partition::index_read_idx_map (find_flag=HA_READ_KEY_EXACT, keypart_map=3, key=0x7f6cc2b72720 "", index=0, buf=0x7f6cb011dfc0 "\375\002", this=0x7f6cb011c910) at /data/src/10.4/sql/ha_partition.cc:5838
      #9  ha_partition::index_read_idx_map (this=0x7f6cb011c910, buf=0x7f6cb011dfc0 "\375\002", index=0, key=0x7f6cc2b72720 "", keypart_map=3, find_flag=<optimized out>) at /data/src/10.4/sql/ha_partition.cc:5810
      #10 0x000055850e1e8bed in handler::ha_index_read_idx_map (this=0x7f6cb011c910, buf=0x7f6cb011dfc0 "\375\002", index=index@entry=0, key=key@entry=0x7f6cc2b72720 "", keypart_map=3, find_flag=find_flag@entry=HA_READ_KEY_EXACT) at /data/src/10.4/sql/handler.cc:2914
      #11 0x000055850dfc37a8 in write_record (thd=thd@entry=0x7f6cb0000c08, table=table@entry=0x7f6cb00c4c28, info=info@entry=0x7f6cc2b728b0) at /data/src/10.4/sql/sql_insert.cc:1806
      #12 0x000055850dfc9896 in mysql_insert (thd=thd@entry=0x7f6cb0000c08, table_list=<optimized out>, fields=..., values_list=..., update_fields=..., update_values=..., duplic=<optimized out>, ignore=<optimized out>) at /data/src/10.4/sql/sql_insert.cc:1078
      #13 0x000055850dff535a in mysql_execute_command (thd=0x7f6cb0000c08) at /data/src/10.4/sql/sql_parse.cc:4528
      #14 0x000055850dffbfd8 in mysql_parse (thd=thd@entry=0x7f6cb0000c08, rawbuf=<optimized out>, length=49, parser_state=parser_state@entry=0x7f6cc2b75190, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /data/src/10.4/sql/sql_parse.cc:7900
      #15 0x000055850dffe2af in dispatch_command (command=COM_QUERY, thd=0x7f6cb0000c08, packet=<optimized out>, packet_length=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.4/sql/sql_class.h:1168
      #16 0x000055850dfff9df in do_command (thd=0x7f6cb0000c08) at /data/src/10.4/sql/sql_parse.cc:1359
      #17 0x000055850e0d38f4 in do_handle_one_connection (connect=connect@entry=0x558510515188) at /data/src/10.4/sql/sql_connect.cc:1412
      #18 0x000055850e0d39e4 in handle_one_connection (arg=arg@entry=0x558510515188) at /data/src/10.4/sql/sql_connect.cc:1316
      #19 0x000055850e62d2bf in pfs_spawn_thread (arg=0x558510524cd8) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #20 0x00007f6cc941afa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
      #21 0x00007f6cc8c694cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
       
      Trying to get some variables.
      Some pointers may be invalid and cause the dump to abort.
      Query (0x7f6cb0010020): REPLACE INTO t1 VALUES (1,0,''),(2,0,''),(0,0,'')
      Connection ID (thread ID): 4
      Status: NOT_KILLED
      

      10.3 debug 6577a7a8

      mysqld: /data/src/10.3/storage/maria/ma_search.c:130: _ma_search_no_save: Assertion `info->last_key.keyinfo == key->keyinfo' failed.
      200418  3:18:51 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f4c736b8102 in __GI___assert_fail (assertion=0x55f97e383f20 "info->last_key.keyinfo == key->keyinfo", file=0x55f97e383da0 "/data/src/10.3/storage/maria/ma_search.c", line=130, function=0x55f97e384e40 <__PRETTY_FUNCTION__.18407> "_ma_search_no_save") at assert.c:101
      #8  0x000055f97d545200 in _ma_search_no_save (info=0x629000168270, key=0x7f4c69525d10, nextflag=1, pos=8192, res_page_link=0x7f4c69525b60, res_page_buff=0x7f4c69525ba0) at /data/src/10.3/storage/maria/ma_search.c:130
      #9  0x000055f97d544a8d in _ma_search (info=0x629000168270, key=0x7f4c69525d10, nextflag=1, pos=8192) at /data/src/10.3/storage/maria/ma_search.c:77
      #10 0x000055f97d54072a in maria_rkey (info=0x629000168270, buf=0x619000092a60 "\375\002", inx=0, key_data=0x7f4c69526200 "", keypart_map=3, search_flag=HA_READ_KEY_EXACT) at /data/src/10.3/storage/maria/ma_rkey.c:104
      #11 0x000055f97d479dc2 in ha_maria::index_read_idx_map (this=0x61d000218510, buf=0x619000092a60 "\375\002", index=0, key=0x7f4c69526200 "", keypart_map=3, find_flag=HA_READ_KEY_EXACT) at /data/src/10.3/storage/maria/ha_maria.cc:2298
      #12 0x000055f97c4e3bba in handler::ha_index_read_idx_map (this=0x61d000218510, buf=0x619000092a60 "\375\002", index=0, key=0x7f4c69526200 "", keypart_map=3, find_flag=HA_READ_KEY_EXACT) at /data/src/10.3/sql/handler.cc:2932
      #13 0x000055f97d8c1d32 in ha_partition::index_read_idx_map (this=0x61d000217110, buf=0x619000092a60 "\375\002", index=0, key=0x7f4c69526200 "", keypart_map=3, find_flag=HA_READ_KEY_EXACT) at /data/src/10.3/sql/ha_partition.cc:5805
      #14 0x000055f97c4e3aa3 in handler::ha_index_read_idx_map (this=0x61d000217110, buf=0x619000092a60 "\375\002", index=0, key=0x7f4c69526200 "", keypart_map=3, find_flag=HA_READ_KEY_EXACT) at /data/src/10.3/sql/handler.cc:2932
      #15 0x000055f97bc97075 in write_record (thd=0x62a000060270, table=0x61f000056af0, info=0x7f4c69526810) at /data/src/10.3/sql/sql_insert.cc:1784
      #16 0x000055f97bc90e4b in mysql_insert (thd=0x62a000060270, table_list=0x62b0000003d0, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_REPLACE, ignore=false) at /data/src/10.3/sql/sql_insert.cc:1072
      #17 0x000055f97bd3c3f1 in mysql_execute_command (thd=0x62a000060270) at /data/src/10.3/sql/sql_parse.cc:4454
      #18 0x000055f97bd54c47 in mysql_parse (thd=0x62a000060270, rawbuf=0x62b000000290 "REPLACE INTO t1 VALUES (1,0,''),(2,0,''),(0,0,'')", length=49, parser_state=0x7f4c695289a0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7817
      #19 0x000055f97bd2b827 in dispatch_command (command=COM_QUERY, thd=0x62a000060270, packet=0x6290000e6271 "REPLACE INTO t1 VALUES (1,0,''),(2,0,''),(0,0,'')", packet_length=49, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1855
      #20 0x000055f97bd27fc7 in do_command (thd=0x62a000060270) at /data/src/10.3/sql/sql_parse.cc:1401
      #21 0x000055f97c11126c in do_handle_one_connection (connect=0x611000005830) at /data/src/10.3/sql/sql_connect.cc:1403
      #22 0x000055f97c110b24 in handle_one_connection (arg=0x611000005830) at /data/src/10.3/sql/sql_connect.cc:1308
      #23 0x000055f97d85c8cf in pfs_spawn_thread (arg=0x61600000cff0) at /data/src/10.3/storage/perfschema/pfs.cc:1869
      #24 0x00007f4c73f32fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
      #25 0x00007f4c737814cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Reproducible on 10.3-10.5.
      The test case is not applicable to 10.2 due to versioning.

      Attachments

        Issue Links

          Activity

            People

              midenok Aleksey Midenkov
              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.