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

DB_DUPLICATE_KEY on CREATE OR REPLACE after ALTER TABLE change engine

    XMLWordPrintable

Details

    Description

      The test case is very non-deterministic, run with high repeat=N. It usually fails for me within 5-20 attempts, but it can vary a lot on different machines and builds.

      I didn't get any problem on 11.0 with the same test case in a limited number of attempts, but given non-determinism, it is not a guarantee.

      --source include/have_innodb.inc
      --source include/have_partition.inc
       
      --connect (con1,localhost,root,,)
      CREATE TABLE t1 (a INT) ENGINE=InnoDB;
      CREATE TABLE t2 ENGINE=InnoDB AS SELECT * FROM t1;
      CREATE TABLE t3 (b INT) ENGINE=InnoDB PARTITION BY LIST (b) (PARTITION p0 VALUES IN (6, NULL), PARTITION pdef DEFAULT);
      --send
        ALTER TABLE t2 NOWAIT ENGINE Aria;
       
      --connection default
      CREATE OR REPLACE TABLE t3 (col3 INT) ENGINE=InnoDB;
      CREATE OR REPLACE TABLE t2 LIKE t1;
       
      --connection con1
      --reap
      DROP TABLE t3, t2, t1;
      --disconnect con1
      

      bb-11.0-midenok-MDEV-25292 9c054e95e

      mariadbd: /data/src/bb-11.0-midenok-MDEV-25292/storage/innobase/row/row0mysql.cc:2664: dberr_t row_rename_table_for_mysql(const char*, const char*, trx_t*, rename_fk): Assertion `err != DB_DUPLICATE_KEY' failed.
      230206 16:47:15 [ERROR] mysqld got signal 6 ;
       
      #9  0x00007f2c88453df2 in __GI___assert_fail (assertion=0x55bfe4a59000 "err != DB_DUPLICATE_KEY", file=0x55bfe4a554c0 "/data/src/bb-11.0-midenok-MDEV-25292/storage/innobase/row/row0mysql.cc", line=2664, function=0x55bfe4a58d80 "dberr_t row_rename_table_for_mysql(const char*, const char*, trx_t*, rename_fk)") at ./assert/assert.c:101
      #10 0x000055bfe34d6961 in row_rename_table_for_mysql (old_name=0x7f2c791e9280 "test/#sql-create-d0a3b-9-t2", new_name=0x7f2c791e9040 "test/t2", trx=0x7f2c7f3c7940, fk=RENAME_FK) at /data/src/bb-11.0-midenok-MDEV-25292/storage/innobase/row/row0mysql.cc:2664
      #11 0x000055bfe316bfe0 in innobase_rename_table (trx=0x7f2c7f3c7940, from=0x7f2c791ea0d0 "./test/#sql-create-d0a3b-9-t2", to=0x7f2c791ea310 "./test/t2", fk=RENAME_FK) at /data/src/bb-11.0-midenok-MDEV-25292/storage/innobase/handler/ha_innodb.cc:13706
      #12 0x000055bfe3170066 in ha_innobase::rename_table (this=0x62900010bde8, from=0x7f2c791ea0d0 "./test/#sql-create-d0a3b-9-t2", to=0x7f2c791ea310 "./test/t2") at /data/src/bb-11.0-midenok-MDEV-25292/storage/innobase/handler/ha_innodb.cc:14128
      #13 0x000055bfe27c544d in handler::ha_rename_table (this=0x62900010bde8, from=0x7f2c791ea0d0 "./test/#sql-create-d0a3b-9-t2", to=0x7f2c791ea310 "./test/t2") at /data/src/bb-11.0-midenok-MDEV-25292/sql/handler.cc:5349
      #14 0x000055bfe21ad955 in mysql_rename_table (base=0x615000002618, old_db=0x7f2c791ebd38, old_name=0x7f2c791eb060, new_db=0x7f2c791eafe0, new_name=0x7f2c791eb070, id=0x7f2c791eb080, flags=257) at /data/src/bb-11.0-midenok-MDEV-25292/sql/sql_table.cc:5668
      #15 0x000055bfe1f96b32 in rename_table_and_triggers (thd=0x62c0001f0218, param=0x7f2c791eb060, ddl_log_state=0x0, ren_table=0x7f2c791ebd38, new_db=0x7f2c791eafe0, skip_error=false, force_if_exists=0x7f2c791eafd0) at /data/src/bb-11.0-midenok-MDEV-25292/sql/sql_rename.cc:385
      #16 0x000055bfe21a627d in HA_CREATE_INFO::finalize_atomic_replace (this=0x7f2c791ebb00, thd=0x62c0001f0218, orig_table=0x629000109378) at /data/src/bb-11.0-midenok-MDEV-25292/sql/sql_table.cc:4558
      #17 0x000055bfe21b0d8a in mysql_create_like_table (thd=0x62c0001f0218, table=0x629000109378, src_table=0x629000109af8, create_info=0x7f2c791ed790) at /data/src/bb-11.0-midenok-MDEV-25292/sql/sql_table.cc:6155
      #18 0x000055bfe21e4368 in Sql_cmd_create_table_like::execute (this=0x6290001092f0, thd=0x62c0001f0218) at /data/src/bb-11.0-midenok-MDEV-25292/sql/sql_table.cc:12995
      #19 0x000055bfe1eebca4 in mysql_execute_command (thd=0x62c0001f0218, is_called_from_prepared_stmt=false) at /data/src/bb-11.0-midenok-MDEV-25292/sql/sql_parse.cc:6004
      #20 0x000055bfe1ef8bf9 in mysql_parse (thd=0x62c0001f0218, rawbuf=0x629000109238 "CREATE OR REPLACE TABLE t2 LIKE t1", length=34, parser_state=0x7f2c791eea20) at /data/src/bb-11.0-midenok-MDEV-25292/sql/sql_parse.cc:8005
      #21 0x000055bfe1ecf582 in dispatch_command (command=COM_QUERY, thd=0x62c0001f0218, packet=0x6290006bd219 "CREATE OR REPLACE TABLE t2 LIKE t1", packet_length=34, blocking=true) at /data/src/bb-11.0-midenok-MDEV-25292/sql/sql_parse.cc:1894
      #22 0x000055bfe1ecc342 in do_command (thd=0x62c0001f0218, blocking=true) at /data/src/bb-11.0-midenok-MDEV-25292/sql/sql_parse.cc:1407
      #23 0x000055bfe237a65b in do_handle_one_connection (connect=0x608000002fb8, put_in_cache=true) at /data/src/bb-11.0-midenok-MDEV-25292/sql/sql_connect.cc:1416
      #24 0x000055bfe2379ff1 in handle_one_connection (arg=0x608000002cb8) at /data/src/bb-11.0-midenok-MDEV-25292/sql/sql_connect.cc:1318
      #25 0x000055bfe2f58a20 in pfs_spawn_thread (arg=0x617000007418) at /data/src/bb-11.0-midenok-MDEV-25292/storage/perfschema/pfs.cc:2201
      #26 0x00007f2c884a7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #27 0x00007f2c8852866c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Attachments

        Issue Links

          Activity

            People

              vlad.lesin Vladislav Lesin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              8 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.