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

Assertion `!table->pos_in_locked_tables' failed in tc_release_table or unexpected ER_TABLE_NOT_LOCKED upon DDL on partitioned table

    XMLWordPrintable

    Details

      Description

      --source include/have_partition.inc
       
      CREATE TABLE t1 (i INT, col_blob BLOB NOT NULL DEFAULT '') PARTITION BY RANGE(i) (PARTITION p0 VALUES LESS THAN (10));
      CREATE TABLE t2 (a INT);
      SET SQL_MODE= 'EMPTY_STRING_IS_NULL';
      LOCK TABLE t1 WRITE, t2 WRITE;
      --error ER_INVALID_DEFAULT
      ALTER TABLE t1 ADD PARTITION (PARTITION p1 VALUES LESS THAN (20));
       
      DROP TABLE t1, t2;
      

      10.4 aa7f2578

      mysqld: /data/src/10.4/sql/table_cache.cc:463: void tc_release_table(TABLE*): Assertion `!table->pos_in_locked_tables' failed.
      200405  2:57:37 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f2ab124b102 in __GI___assert_fail (assertion=0x564c891b5300 "!table->pos_in_locked_tables", file=0x564c891b4da0 "/data/src/10.4/sql/table_cache.cc", line=463, function=0x564c891b6460 <tc_release_table(TABLE*)::__PRETTY_FUNCTION__> "void tc_release_table(TABLE*)") at assert.c:101
      #8  0x0000564c8782944a in tc_release_table (table=0x62000003e0f0) at /data/src/10.4/sql/table_cache.cc:463
      #9  0x0000564c87073b6e in close_thread_table (thd=0x62b00005b270, table_ptr=0x62b00005b350) at /data/src/10.4/sql/sql_base.cc:1078
      #10 0x0000564c87e814aa in handle_alter_part_error (lpt=0x7f2aa8296720, action_completed=false, drop_partition=false, frm_install=false, close_table=false) at /data/src/10.4/sql/sql_partition.cc:6956
      #11 0x0000564c87e82d97 in fast_alter_partition_table (thd=0x62b00005b270, table=0x62000003d0f0, alter_info=0x7f2aa8299750, create_info=0x7f2aa8299830, table_list=0x62b0000623f0, db=0x7f2aa8297d70, table_name=0x7f2aa8297d80) at /data/src/10.4/sql/sql_partition.cc:7375
      #12 0x0000564c87468a78 in mysql_alter_table (thd=0x62b00005b270, new_db=0x62b00005fa30, new_name=0x62b00005fe38, create_info=0x7f2aa8299830, table_list=0x62b0000623f0, alter_info=0x7f2aa8299750, order_num=0, order=0x0, ignore=false) at /data/src/10.4/sql/sql_table.cc:9875
      #13 0x0000564c875e2f7b in Sql_cmd_alter_table::execute (this=0x62b0000632d8, thd=0x62b00005b270) at /data/src/10.4/sql/sql_alter.cc:502
      #14 0x0000564c872154c7 in mysql_execute_command (thd=0x62b00005b270) at /data/src/10.4/sql/sql_parse.cc:6101
      #15 0x0000564c8722147a in mysql_parse (thd=0x62b00005b270, rawbuf=0x62b000062290 "ALTER TABLE t1 ADD PARTITION (PARTITION p1 VALUES LESS THAN (20))", length=65, parser_state=0x7f2aa829e5d0, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7900
      #16 0x0000564c871f62ef in dispatch_command (command=COM_QUERY, thd=0x62b00005b270, packet=0x629000226271 "ALTER TABLE t1 ADD PARTITION (PARTITION p1 VALUES LESS THAN (20))", packet_length=65, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1841
      #17 0x0000564c871f2a98 in do_command (thd=0x62b00005b270) at /data/src/10.4/sql/sql_parse.cc:1359
      #18 0x0000564c875cadd4 in do_handle_one_connection (connect=0x6110000083f0) at /data/src/10.4/sql/sql_connect.cc:1412
      #19 0x0000564c875ca676 in handle_one_connection (arg=0x6110000083f0) at /data/src/10.4/sql/sql_connect.cc:1316
      #20 0x0000564c88c0866d in pfs_spawn_thread (arg=0x61600000ccf0) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #21 0x00007f2ab1ac5fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
      #22 0x00007f2ab13144cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Non-debug build does not crash, ALTER fails with ER_INVALID_DEFAULT which is probably okay, but DROP TABLE causes an unexpected error ER_TABLE_NOT_LOCKED:

      10.4 non-debug

      mysqltest: At line 10: query 'DROP TABLE t1, t2' failed: 1100: Table 't2' was not locked with LOCK TABLES
      

      Reproducible on 10.4, 10.5 with at least InnoDB and MyISAM.
      Not reproducible on 10.3, but because on 10.3 ADD PARTITION passes, it doesn't cause ER_INVALID_DEFAULT.

        Attachments

          Activity

            People

            Assignee:
            sanja Oleksandr Byelkin
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: