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

Server crashes in copy_data_between_tables or Assertion `thd->transaction.stmt.is_empty() || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)' fails in close_tables_for_reopen upon concurrent ALTER TABLE and FLUSH

    XMLWordPrintable

Details

    Description

      Run with --repeat=N. For me it fails within first 3-5 attempts, but it can be different on different machines.

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (pk INT PRIMARY KEY, c INT) ENGINE=InnoDB;
      CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=InnoDB;
       
      --connect (con1,localhost,root,,test)
       
      ALTER TABLE t1 DROP COLUMN IF EXISTS f;
      --send
        ALTER TABLE t1 ADD FOREIGN KEY (c) REFERENCES t2 (pk);
       
      --connection default
      FLUSH TABLES;
       
      # Cleanup
      --connection con1
      --reap
      --disconnect con1
      --connection default
      DROP TABLE t1, t2;
      

      10.0 non-debug a737135ae39da

      #3  0x0000000000000000 in ?? ()
      #4  0x00000000006ddafa in Copy_field::set (this=0x7f688c01feb8, to=0x7f688c02f458, from=0x7f688c02e458, save=<optimized out>) at /data/src/10.0/sql/field_conv.cc:644
      #5  0x00000000005126cb in copy_data_between_tables (thd=0x7f6893f9d008, from=0x7f688c02f458, to=0x7f688c0d2008, create=..., ignore=56, order_num=182, order=0x0, copied=0x7f688c05f808, deleted=0x7f688c05f808, keys_onoff=Alter_info::LEAVE_AS_IS, alter_ctx=0x7f68a126e6d0) at /data/src/10.0/sql/sql_table.cc:9551
      #6  0x0000000000622578 in mysql_alter_table (thd=0x7f6893f9d008, new_db=0x7f688c10d020 "", new_name=0x7f6893fa07a0 "\360\225\260", create_info=0x7f688c0d2008, table_list=0x7f688c01e138, alter_info=0xb6, order_num=0, order=0x0, ignore=false) at /data/src/10.0/sql/sql_table.cc:9150
      #7  0x000000000065ff8d in Sql_cmd_alter_table::execute (this=0x7f688c02e458, thd=0x7f6893f9d008) at /data/src/10.0/sql/sql_alter.cc:312
      #8  0x00000000005a5431 in mysql_execute_command (thd=0x7f6893f9d008) at /data/src/10.0/sql/sql_parse.cc:5118
      #9  0x00000000005aba68 in mysql_parse (thd=0x7f6893f9d008, rawbuf=<optimized out>, length=53, parser_state=0x7f68a1270850) at /data/src/10.0/sql/sql_parse.cc:6637
      #10 0x00000000005ad414 in dispatch_command (command=<optimized out>, thd=0x7f6893f9d008, packet=<optimized out>, packet_length=<optimized out>) at /data/src/10.0/sql/sql_parse.cc:1300
      #11 0x00000000005add7f in do_command (thd=<optimized out>) at /data/src/10.0/sql/sql_parse.cc:1003
      #12 0x000000000065d6d4 in do_handle_one_connection (thd_arg=thd_arg@entry=0x7f6893f9d008) at /data/src/10.0/sql/sql_connect.cc:1377
      #13 0x000000000065d718 in handle_one_connection (arg=arg@entry=0x7f6893f9d008) at /data/src/10.0/sql/sql_connect.cc:1292
      #14 0x0000000000891f14 in pfs_spawn_thread (arg=0x7f689e83fc08) at /data/src/10.0/storage/perfschema/pfs.cc:1861
      #15 0x00007f68a0ef6494 in start_thread (arg=0x7f68a1271700) at pthread_create.c:333
      #16 0x00007f689f4ca93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      10.0 debug a737135ae39da

      mysqld: /data/src/10.0/sql/sql_base.cc:5673: void close_tables_for_reopen(THD*, TABLE_LIST**, const MDL_savepoint&): Assertion `thd->transaction.stmt.is_empty() || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)' failed.
      181101 21:39:48 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fca51305ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x00000000005f1ed1 in close_tables_for_reopen (thd=0x7fca4576f070, tables=0x7fca3d4221a8, start_of_statement_svp=...) at /data/src/10.0/sql/sql_base.cc:5672
      #9  0x00000000005effb2 in open_tables (thd=0x7fca4576f070, start=0x7fca3d4221a8, counter=0x7fca5316731c, flags=0, prelocking_strategy=0x7fca53167320) at /data/src/10.0/sql/sql_base.cc:4613
      #10 0x0000000000707443 in mysql_alter_table (thd=0x7fca4576f070, new_db=0x7fca3d422780 "test", new_name=0x0, create_info=0x7fca531674e0, table_list=0x7fca3d4221a0, alter_info=0x7fca53167450, order_num=0, order=0x0, ignore=false) at /data/src/10.0/sql/sql_table.cc:9120
      #11 0x000000000076fd75 in Sql_cmd_alter_table::execute (this=0x7fca3d422980, thd=0x7fca4576f070) at /data/src/10.0/sql/sql_alter.cc:312
      #12 0x0000000000654b16 in mysql_execute_command (thd=0x7fca4576f070) at /data/src/10.0/sql/sql_parse.cc:5118
      #13 0x000000000065816c in mysql_parse (thd=0x7fca4576f070, rawbuf=0x7fca3d422088 "ALTER TABLE t1 ADD FOREIGN KEY (c) REFERENCES t2 (pk)", length=53, parser_state=0x7fca53168640) at /data/src/10.0/sql/sql_parse.cc:6637
      #14 0x000000000064aa8c in dispatch_command (command=COM_QUERY, thd=0x7fca4576f070, packet=0x7fca45775071 "ALTER TABLE t1 ADD FOREIGN KEY (c) REFERENCES t2 (pk)", packet_length=53) at /data/src/10.0/sql/sql_parse.cc:1300
      #15 0x0000000000649d8c in do_command (thd=0x7fca4576f070) at /data/src/10.0/sql/sql_parse.cc:1003
      #16 0x000000000076b4c8 in do_handle_one_connection (thd_arg=0x7fca4576f070) at /data/src/10.0/sql/sql_connect.cc:1377
      #17 0x000000000076b23a in handle_one_connection (arg=0x7fca4576f070) at /data/src/10.0/sql/sql_connect.cc:1292
      #18 0x0000000000accfe2 in pfs_spawn_thread (arg=0x7fca45719b70) at /data/src/10.0/storage/perfschema/pfs.cc:1861
      #19 0x00007fca52dee494 in start_thread (arg=0x7fca53169700) at pthread_create.c:333
      #20 0x00007fca513c293f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      Reproducible on 10.0, 10.1, 10.2, 10.3, 10.4.

      Attachments

        Issue Links

          Activity

            People

              svoj Sergey Vojtovich
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.