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

Server crashes in Locked_tables_list::mark_table_for_reopen upon ALTER TABLE

    XMLWordPrintable

Details

    Description

      Setting to minor because only 10.2 seems to be affected

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (pk INT, f TEXT NOT NULL) ENGINE=InnoDB;
      ALTER TABLE t1 ALTER f SET DEFAULT NULL;
      CREATE TABLE t2 (a INT) ENGINE=InnoDB;
      CREATE TABLE t3 (b INT) ENGINE=InnoDB;
       
      --error ER_BAD_FIELD_ERROR
      ALTER TABLE t2 ORDER BY x;
       
      LOCK TABLE t1 WRITE, t3 WRITE;
      --error ER_BAD_NULL_ERROR
      ALTER TABLE t1 ADD PRIMARY KEY(pk);
      ALTER TABLE t3 CHANGE IF EXISTS b c INT;
       
      # Cleanup
      UNLOCK TABLES;
      DROP TABLE t1, t2, t3;
      

      10.2 676987c4

      #3  <signal handler called>
      #4  Locked_tables_list::mark_table_for_reopen (this=0x7f3f800047f8, thd=0x7f3f80000d90, table=0x7f3f8009ac60) at /data/src/10.2/sql/sql_base.cc:2420
      #5  0x000055c1e4ef8ff8 in TABLE::mark_table_for_reopen (this=0x7f3f8009ac60) at /data/src/10.2/sql/table.cc:8675
      #6  0x000055c1e4eb5ad9 in mysql_prepare_alter_table (thd=0x7f3f80000d90, table=0x7f3f8009ac60, create_info=0x7f3fcb00b2f0, alter_info=0x7f3fcb00b240, alter_ctx=0x7f3fcb00a6d0) at /data/src/10.2/sql/sql_table.cc:7811
      #7  0x000055c1e4eb9d76 in mysql_alter_table (thd=0x7f3f80000d90, new_db=0x7f3f80012e00 "test", new_name=0x0, create_info=0x7f3fcb00b2f0, table_list=0x7f3f800127e8, alter_info=0x7f3fcb00b240, order_num=0, order=0x0, ignore=false) at /data/src/10.2/sql/sql_table.cc:9291
      #8  0x000055c1e4f39048 in Sql_cmd_alter_table::execute (this=0x7f3f80012ef8, thd=0x7f3f80000d90) at /data/src/10.2/sql/sql_alter.cc:333
      #9  0x000055c1e4de743b in mysql_execute_command (thd=0x7f3f80000d90) at /data/src/10.2/sql/sql_parse.cc:6021
      #10 0x000055c1e4dec28d in mysql_parse (thd=0x7f3f80000d90, rawbuf=0x7f3f800126f8 "ALTER TABLE t3 CHANGE IF EXISTS b c INT", length=39, parser_state=0x7f3fcb00c5f0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7790
      #11 0x000055c1e4dda4ca in dispatch_command (command=COM_QUERY, thd=0x7f3f80000d90, packet=0x7f3f80008b51 "ALTER TABLE t3 CHANGE IF EXISTS b c INT", packet_length=39, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1827
      #12 0x000055c1e4dd8fc5 in do_command (thd=0x7f3f80000d90) at /data/src/10.2/sql/sql_parse.cc:1381
      #13 0x000055c1e4f33a3e in do_handle_one_connection (connect=0x55c1e7495560) at /data/src/10.2/sql/sql_connect.cc:1336
      #14 0x000055c1e4f337a3 in handle_one_connection (arg=0x55c1e7495560) at /data/src/10.2/sql/sql_connect.cc:1241
      #15 0x000055c1e575c894 in pfs_spawn_thread (arg=0x55c1e7478950) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #16 0x00007f3fd50b6609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #17 0x00007f3fd4c90293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Reproducible on debug- and non-debug alike.
      Couldn't reproduce on 10.3.
      Couldn't reproduce with MyISAM instead of InnoDB.

      The failure appeared in 10.2 after this commit:

      commit be647ff14d6196af825f05020acee8f18af4773d
      Author: Monty
      Date:   Fri May 22 18:02:24 2020 +0300
       
          Fixed deadlock with LOCK TABLES and ALTER TABLE
          
          MDEV-21398 Deadlock (server hang) or assertion failure in
      

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.