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

Deadlock and assertion upon no-op ALTER under LOCK TABLES

    XMLWordPrintable

Details

    Description

      Assertion `!table->pos_in_locked_tables' failed in tc_release_table or unexpected ER_STATEMENT_TIMEOUT upon altering table under locks

      I'm not sure versioning has anything to do with it, but I could only reproduce it so far with ADD PERIOD FOR SYSTEM_TIME

      SET max_statement_time= 1;
      CREATE TABLE t1 (pk int, i int, primary key (pk)) ENGINE=MyISAM;
      CREATE VIEW v1 AS SELECT * FROM t1;
      LOCK TABLE v1 READ, t1 WRITE;
      --error ER_BAD_FIELD_ERROR
      ALTER TABLE t1 CHANGE f1 f2 INT;
      ALTER TABLE t1 ADD PERIOD FOR SYSTEM_TIME(s,e);
       
      # Cleanup
      UNLOCK TABLES;
      DROP VIEW v1;
      DROP TABLE t1;
      

      10.3 debug build faf206a848

      mysqld: /data/src/10.3/sql/table_cache.cc:466: void tc_release_table(TABLE*): Assertion `!table->pos_in_locked_tables' failed.
      190106 20:29:08 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f9ad6b03ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x0000564bc90ea7a8 in tc_release_table (table=0x7f9ac0121ae0) at /data/src/10.3/sql/table_cache.cc:466
      #9  0x0000564bc8e317ef in close_thread_table (thd=0x7f9ac0000b00, table_ptr=0x7f9ac0000be0) at /data/src/10.3/sql/sql_base.cc:912
      #10 0x0000564bc8e346a7 in Locked_tables_list::unlink_all_closed_tables (this=0x7f9ac00047f8, thd=0x7f9ac0000b00, lock=0x0, reopen_count=0) at /data/src/10.3/sql/sql_base.cc:2429
      #11 0x0000564bc8e34a9e in Locked_tables_list::reopen_tables (this=0x7f9ac00047f8, thd=0x7f9ac0000b00, need_reopen=false) at /data/src/10.3/sql/sql_base.cc:2526
      #12 0x0000564bc8fa481e in mysql_alter_table (thd=0x7f9ac0000b00, new_db=0x7f9ac00051b8, new_name=0x7f9ac0005578, create_info=0x7f9ad0ca8c80, table_list=0x7f9ac0014de0, alter_info=0x7f9ad0ca8bc0, order_num=0, order=0x0, ignore=false) at /data/src/10.3/sql/sql_table.cc:10053
      #13 0x0000564bc902b5ab in Sql_cmd_alter_table::execute (this=0x7f9ac0015440, thd=0x7f9ac0000b00) at /data/src/10.3/sql/sql_alter.cc:497
      #14 0x0000564bc8ecce78 in mysql_execute_command (thd=0x7f9ac0000b00) at /data/src/10.3/sql/sql_parse.cc:6285
      #15 0x0000564bc8ed1f49 in mysql_parse (thd=0x7f9ac0000b00, rawbuf=0x7f9ac0014cd8 "ALTER TABLE t1 ADD PERIOD FOR SYSTEM_TIME(s,e)", length=46, parser_state=0x7f9ad0caa5f0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8092
      #16 0x0000564bc8ebf0fd in dispatch_command (command=COM_QUERY, thd=0x7f9ac0000b00, packet=0x7f9ac000b1e1 "ALTER TABLE t1 ADD PERIOD FOR SYSTEM_TIME(s,e)", packet_length=46, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1851
      #17 0x0000564bc8ebdb21 in do_command (thd=0x7f9ac0000b00) at /data/src/10.3/sql/sql_parse.cc:1396
      #18 0x0000564bc9025b36 in do_handle_one_connection (connect=0x564bcd050b30) at /data/src/10.3/sql/sql_connect.cc:1402
      #19 0x0000564bc90258ba in handle_one_connection (arg=0x564bcd050b30) at /data/src/10.3/sql/sql_connect.cc:1308
      #20 0x0000564bc94c01e1 in pfs_spawn_thread (arg=0x564bcd09d750) at /data/src/10.3/storage/perfschema/pfs.cc:1862
      #21 0x00007f9ad85bf494 in start_thread (arg=0x7f9ad0cab700) at pthread_create.c:333
      #22 0x00007f9ad6bc093f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      10.3 non-debug build faf206a848

      mysqltest: At line 7: query 'ALTER TABLE t1 ADD PERIOD FOR SYSTEM_TIME(s,e)' failed: 1969: Query execution was interrupted (max_statement_time exceeded)
      

      Cannot check 10.2, because the test case uses ADD PERIOD.

      Attachments

        Issue Links

          Activity

            People

              midenok Aleksey Midenkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.