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

Invalid (old?) table or database name, Assertion `false' failed in handler::get_foreign_dup_key, unexpected FK errors

    XMLWordPrintable

    Details

      Description

      Note that the test case uses WITHOUT OVERLAPS (through a versioned executable comment), maybe that's why the effect is different on 10.4 and 10.5+.

      --source include/have_innodb.inc
      --source include/have_partition.inc
       
      CREATE TABLE t (id INT, f INT, s DATE DEFAULT '2000-01-01', e DATE, PERIOD FOR p(s,e), PRIMARY KEY(id /*!100503, p WITHOUT OVERLAPS*/)) ENGINE=InnoDB WITH SYSTEM VERSIONING PARTITION BY KEY(id);
      INSERT INTO t (id, e) VALUES (128,'2020-01-01');
      INSERT INTO t (id, e) VALUES (129,'2021-01-01');
      INSERT INTO t (id, e) VALUES (130,'2021-01-01');
      UPDATE t SET f = 1;
       
      SET STATEMENT system_versioning_alter_history= KEEP FOR ALTER IGNORE TABLE t MODIFY id TINYINT;
      

      10.4 c7443a09

      mysqltest: At line 10: query 'SET STATEMENT system_versioning_alter_history= KEEP FOR ALTER IGNORE TABLE t MODIFY id TINYINT' failed: 1761: Foreign key constraint for table 't', record '127' would lead to a duplicate entry in table '#mysql50##sql-2116b1_9#P#p0', key 'PRIMARY'
       
      2021-07-03  0:57:05 9 [ERROR] Invalid (old?) table or database name '#sql-2116b1_9#P#p0'
      

      10.5 617dee34 non-debug

      mysqltest: At line 10: query 'SET STATEMENT system_versioning_alter_history= KEEP FOR ALTER IGNORE TABLE t MODIFY id TINYINT' failed: 1762: Foreign key constraint for table 't', record '127-2021-01-01-2000-01-01' would lead to a duplicate entry in a child table
      

      (Note that the error is different from the previous one, ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO vs ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO)

      10.5 617dee34 debug

      mariadbd: /data/src/10.5/sql/handler.h:3521: virtual bool handler::get_foreign_dup_key(char*, uint, char*, uint): Assertion `false' failed.
      210703  1:00:23 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f9790a2ef36 in __GI___assert_fail (assertion=0x55c60dd39f51 "false", file=0x55c60dd39c16 "/data/src/10.5/sql/handler.h", line=3521, function=0x55c60dd39f58 "virtual bool handler::get_foreign_dup_key(char*, uint, char*, uint)") at assert.c:101
      #8  0x000055c60d10d9d3 in handler::get_foreign_dup_key (this=0x7f975c0674b0, child_table_name=0x7f9785c57fc0 "\340\177\305\205\227\177", child_table_name_len=193, child_key_name=0x7f9785c58090 "", child_key_name_len=193) at /data/src/10.5/sql/handler.h:3521
      #9  0x000055c60d0ff272 in handler::print_error (this=0x7f975c0674b0, error=163, errflag=0) at /data/src/10.5/sql/handler.cc:4036
      #10 0x000055c60d488e9f in ha_partition::print_error (this=0x7f975c0674b0, error=163, errflag=0) at /data/src/10.5/sql/ha_partition.cc:10051
      #11 0x000055c60ce93d34 in copy_data_between_tables (thd=0x7f975c000db8, from=0x7f975c215b98, to=0x7f975c066bb8, create=..., ignore=true, order_num=0, order=0x0, copied=0x7f9785c5a7a0, deleted=0x7f9785c5a7a8, keys_onoff=Alter_info::LEAVE_AS_IS, alter_ctx=0x7f9785c5b820) at /data/src/10.5/sql/sql_table.cc:11532
      #12 0x000055c60ce916f0 in mysql_alter_table (thd=0x7f975c000db8, new_db=0x7f975c005828, new_name=0x7f975c005c48, create_info=0x7f9785c5c430, table_list=0x7f975c0156d0, alter_info=0x7f9785c5c360, order_num=0, order=0x0, ignore=true, if_exists=false) at /data/src/10.5/sql/sql_table.cc:10870
      #13 0x000055c60cf39b30 in Sql_cmd_alter_table::execute (this=0x7f975c015ec0, thd=0x7f975c000db8) at /data/src/10.5/sql/sql_alter.cc:539
      #14 0x000055c60cd8e711 in mysql_execute_command (thd=0x7f975c000db8) at /data/src/10.5/sql/sql_parse.cc:6052
      #15 0x000055c60cd94922 in mysql_parse (thd=0x7f975c000db8, rawbuf=0x7f975c015310 "SET STATEMENT system_versioning_alter_history= KEEP FOR ALTER IGNORE TABLE t MODIFY id TINYINT", length=94, parser_state=0x7f9785c5d490, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:8096
      #16 0x000055c60cd808cb in dispatch_command (command=COM_QUERY, thd=0x7f975c000db8, packet=0x7f975c00b5c9 "SET STATEMENT system_versioning_alter_history= KEEP FOR ALTER IGNORE TABLE t MODIFY id TINYINT", packet_length=94, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1891
      #17 0x000055c60cd7f0bd in do_command (thd=0x7f975c000db8) at /data/src/10.5/sql/sql_parse.cc:1370
      #18 0x000055c60cf2ef52 in do_handle_one_connection (connect=0x55c60f7a8368, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1410
      #19 0x000055c60cf2ecb5 in handle_one_connection (arg=0x55c60f7a8288) at /data/src/10.5/sql/sql_connect.cc:1312
      #20 0x000055c60d493ea7 in pfs_spawn_thread (arg=0x55c60f8a10d8) at /data/src/10.5/storage/perfschema/pfs.cc:2201
      #21 0x00007f9790f47609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #22 0x00007f9790b1a293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      10.6 fails the same way as 10.5.

        Attachments

          Activity

            People

            Assignee:
            nikitamalyavin Nikita Malyavin
            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.