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

Assertion failure err != DB_DUPLICATE_KEY or unexpected ER_TABLE_EXISTS_ERROR (backport MDEV-25902)

    XMLWordPrintable

Details

    Description

      Test case from MDEV-25902 which was recently fixed in 10.6 is partially applicable to previous versions as well. They don't exhibit the strange ALTER behavior (when it fails but still performs the operation), but otherwise they also lead to the schema inconsistency.

      --source include/have_partition.inc
      --source include/have_innodb.inc
       
      CREATE TABLE t1 (pk int primary key) ENGINE=InnoDB;
      CREATE TABLE t2 (pk int primary key) ENGINE=InnoDB;
       
      --connect (con1,localhost,root,,test)
       
      START TRANSACTION;
      INSERT INTO t2 (pk) VALUES (1);
      SAVEPOINT sp;
      INSERT INTO t1 (pk) VALUES (1);
      ROLLBACK TO SAVEPOINT sp;
       
      --connection default
      ALTER TABLE t1 PARTITION BY HASH(pk);
       
      SHOW CREATE TABLE t1;
       
      --connection con1
      COMMIT;
       
      --connection default
      ALTER TABLE t2 PARTITION BY HASH(pk);
       
      # Cleanup
      --disconnect con1
      --connection default
      DROP TABLE t1, t2;
      

      10.2 eb20c91b

      mysqltest: At line 24: query 'ALTER TABLE t2 PARTITION BY HASH(pk)' failed: 1050: Table './test/#sql2-1f48cb-9' already exists
      

      10.3 4a6e2d34

      mysqld: /data/src/10.3/storage/innobase/row/row0mysql.cc:4350: dberr_t row_rename_table_for_mysql(const char*, const char*, trx_t*, bool, bool): Assertion `err != DB_DUPLICATE_KEY' failed.
      210702 10:36:26 [ERROR] mysqld got signal 6 ;
       
      #6  0x00007fcd504c0729 in __assert_fail_base (fmt=0x7fcd50656588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x556d4205de45 "err != DB_DUPLICATE_KEY", file=0x556d4205b0c8 "/data/src/10.3/storage/innobase/row/row0mysql.cc", line=4350, function=<optimized out>) at assert.c:92
      #7  0x00007fcd504d1f36 in __GI___assert_fail (assertion=0x556d4205de45 "err != DB_DUPLICATE_KEY", file=0x556d4205b0c8 "/data/src/10.3/storage/innobase/row/row0mysql.cc", line=4350, function=0x556d4205dcc8 "dberr_t row_rename_table_for_mysql(const char*, const char*, trx_t*, bool, bool)") at assert.c:101
      #8  0x0000556d418bb844 in row_rename_table_for_mysql (old_name=0x7fcd4953e810 "test/t2", new_name=0x7fcd4953e610 "test/#sql2-1f492f-9", trx=0x7fcd4a043228, commit=true, use_fk=true) at /data/src/10.3/storage/innobase/row/row0mysql.cc:4350
      #9  0x0000556d417390ad in innobase_rename_table (trx=0x7fcd4a043228, from=0x7fcd4953f7c0 "./test/t2", to=0x7fcd4953f9d0 "./test/#sql2-1f492f-9", commit=true) at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:13486
      #10 0x0000556d417209b3 in ha_innobase::rename_table (this=0x7fccfc015578, from=0x7fcd4953f7c0 "./test/t2", to=0x7fcd4953f9d0 "./test/#sql2-1f492f-9") at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:13684
      #11 0x0000556d414dff0f in handler::ha_rename_table (this=0x7fccfc015578, from=0x7fcd4953f7c0 "./test/t2", to=0x7fcd4953f9d0 "./test/#sql2-1f492f-9") at /data/src/10.3/sql/handler.cc:4696
      #12 0x0000556d4128a1b1 in mysql_rename_table (base=0x556d43dd3060, old_db=0x7fcd495408b0, old_name=0x7fcd495408c0, new_db=0x7fcd495408b0, new_name=0x7fcd49540170, flags=2) at /data/src/10.3/sql/sql_table.cc:5611
      #13 0x0000556d41297463 in mysql_alter_table (thd=0x7fccfc000d90, new_db=0x7fccfc005488, new_name=0x7fccfc005870, create_info=0x7fcd49541490, table_list=0x7fccfc012bd8, alter_info=0x7fcd495413d0, order_num=0, order=0x0, ignore=false) at /data/src/10.3/sql/sql_table.cc:10263
      #14 0x0000556d4132798c in Sql_cmd_alter_table::execute (this=0x7fccfc013598, thd=0x7fccfc000d90) at /data/src/10.3/sql/sql_alter.cc:512
      #15 0x0000556d411b0e1b in mysql_execute_command (thd=0x7fccfc000d90) at /data/src/10.3/sql/sql_parse.cc:6075
      #16 0x0000556d411b64da in mysql_parse (thd=0x7fccfc000d90, rawbuf=0x7fccfc012ae8 "ALTER TABLE t2 PARTITION BY HASH(pk)", length=36, parser_state=0x7fcd49542530, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7870
      #17 0x0000556d411a2b97 in dispatch_command (command=COM_QUERY, thd=0x7fccfc000d90, packet=0x7fccfc008f41 "", packet_length=36, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1852
      #18 0x0000556d411a1537 in do_command (thd=0x7fccfc000d90) at /data/src/10.3/sql/sql_parse.cc:1398
      #19 0x0000556d41321822 in do_handle_one_connection (connect=0x556d440df920) at /data/src/10.3/sql/sql_connect.cc:1403
      #20 0x0000556d4132157e in handle_one_connection (arg=0x556d440df920) at /data/src/10.3/sql/sql_connect.cc:1308
      #21 0x0000556d41cf6b09 in pfs_spawn_thread (arg=0x556d440c2780) at /data/src/10.3/storage/perfschema/pfs.cc:1869
      #22 0x00007fcd50696609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #23 0x00007fcd505bd293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.