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

Server crashes in key_copy or unexpected error 156: The table already existed in the storage engine

    XMLWordPrintable

Details

    Description

      Note: The problems in the test case start on the first table already. SHOW TABLE STATUS returns Warning 1030 Got error 174 "Fatal error during initialization of handler" from storage engine Aria. This part is described in MDEV-17968 (unrelated to versioning). However, it is disturbing that even after being dropped, this corrupt table keeps affecting further actions.

      --source include/have_partition.inc
       
      CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=Aria PAGE_CHECKSUM=0 WITH SYSTEM VERSIONING PARTITION BY SYSTEM_TIME (PARTITION p1 HISTORY, PARTITION pn CURRENT);
      ALTER TABLE t1 ADD PARTITION (PARTITION p2 HISTORY);
      SHOW TABLE STATUS;
      DROP TABLE t1;
       
      CREATE TABLE t1 (b INT) ENGINE=Aria WITH SYSTEM VERSIONING ROW_FORMAT=DYNAMIC PARTITION BY SYSTEM_TIME (PARTITION p1 HISTORY, PARTITION pn CURRENT);
      INSERT INTO t1 VALUES (1);
      REPLACE INTO t1 VALUES (1);
       
      # Cleanup
      DROP TABLE t1;
      

      On two of machines where I tried, it reliably crashes upon REPLACE on all of debug, non-debug and ASAN builds as follows:

      10.4 af912664

      #3  <signal handler called>
      #4  key_copy (to_key=to_key@entry=0x7fd4d434a730 "", from_record=0x7fd4b8082430 "\376\001", key_info=0x0, key_length=key_length@entry=0, with_zerofill=with_zerofill@entry=false) at /data/src/10.4/sql/key.cc:122
      #5  0x000055f1fab83773 in write_record (thd=thd@entry=0x7fd4b8000c08, table=table@entry=0x7fd4b811e798, info=info@entry=0x7fd4d434a8b0) at /data/src/10.4/sql/sql_insert.cc:1804
      #6  0x000055f1fab89896 in mysql_insert (thd=thd@entry=0x7fd4b8000c08, 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
      #7  0x000055f1fabb535a in mysql_execute_command (thd=0x7fd4b8000c08) at /data/src/10.4/sql/sql_parse.cc:4528
      #8  0x000055f1fabbbfd8 in mysql_parse (thd=thd@entry=0x7fd4b8000c08, rawbuf=<optimized out>, length=26, parser_state=parser_state@entry=0x7fd4d434d190, 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
      #9  0x000055f1fabbe2af in dispatch_command (command=COM_QUERY, thd=0x7fd4b8000c08, 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
      #10 0x000055f1fabbf9df in do_command (thd=0x7fd4b8000c08) at /data/src/10.4/sql/sql_parse.cc:1359
      #11 0x000055f1fac938f4 in do_handle_one_connection (connect=connect@entry=0x55f1fd5f9218) at /data/src/10.4/sql/sql_connect.cc:1412
      #12 0x000055f1fac939e4 in handle_one_connection (arg=arg@entry=0x55f1fd5f9218) at /data/src/10.4/sql/sql_connect.cc:1316
      #13 0x000055f1fb1ed2bf in pfs_spawn_thread (arg=0x55f1fd608d38) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #14 0x00007fd4d9c48fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
      #15 0x00007fd4d94974cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      On the third machine, it fails earlier, upon the 2nd CREATE TABLE, with an error (also on all of debug, non-debug and ASAN builds):

      10.4 af912664

      mysqltest: At line 8: query 'CREATE TABLE t1 (b INT) ENGINE=Aria WITH SYSTEM VERSIONING ROW_FORMAT=DYNAMIC PARTITION BY SYSTEM_TIME (PARTITION p1 HISTORY, PARTITION pn CURRENT)' failed: 156: Aria table 't1#P#pn' is in use (most likely by a MERGE table). Try FLUSH TABLES.
      

      (FLUSH TABLES doesn't help)

      Reproducible on 10.4, 10.5. Not reproducible on 10.3.

      Attachments

        Issue Links

          Activity

            People

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