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

Server crashes in mysql_ha_flush_tables upon ALTER SERVER

    XMLWordPrintable

Details

    Description

      install soname 'ha_federatedx';
      --eval create server s foreign data wrapper 'mysql' options (HOST '127.0.0.1', DATABASE 'test', USER 'root', PASSWORD '', PORT $MASTER_MYPORT, SOCKET '', OWNER 'root');
      create database federated;
      create table test.t1 (a int);
      create table federated.t1 (a int) engine=FEDERATED CONNECTION='s';
      insert into federated.t1 values (1);
      alter server s options (DATABASE 'x');
      

      10.5 d2c366c6

      #3  <signal handler called>
      #4  0x000055a7482b0b91 in mysql_ha_flush_tables (thd=0x7f6bc4000d78, all_tables=0x7f6bc4013c90) at /data/src/10.5/sql/sql_handler.cc:1132
      #5  0x000055a74825791e in close_cached_tables (thd=0x7f6bc4000d78, tables=0x7f6bc4013c90, wait_for_refresh=true, timeout=86400) at /data/src/10.5/sql/sql_base.cc:429
      #6  0x000055a748495135 in close_cached_connection_tables (thd=0x7f6bc4000d78, connection=0x7f6bc4006398) at /data/src/10.5/sql/sql_servers.cc:194
      #7  0x000055a748497603 in alter_server (thd=0x7f6bc4000d78, server_options=0x7f6bc4006390) at /data/src/10.5/sql/sql_servers.cc:1170
      #8  0x000055a74830b3a3 in mysql_execute_command (thd=0x7f6bc4000d78) at /data/src/10.5/sql/sql_parse.cc:5852
      #9  0x000055a748311bd0 in mysql_parse (thd=0x7f6bc4000d78, rawbuf=0x7f6bc4013b90 "alter server s options (DATABASE 'x')", length=37, parser_state=0x7f6be0442510, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:7953
      #10 0x000055a7482fd564 in dispatch_command (command=COM_QUERY, thd=0x7f6bc4000d78, packet=0x7f6bc4008d09 "alter server s options (DATABASE 'x')", packet_length=37, is_com_multi=false, is_next_command=false) at /data/src/10.5/sql/sql_parse.cc:1839
      #11 0x000055a7482fbca2 in do_command (thd=0x7f6bc4000d78) at /data/src/10.5/sql/sql_parse.cc:1358
      #12 0x000055a74849cde0 in do_handle_one_connection (connect=0x55a74b1bc1f8, put_in_cache=true) at /data/src/10.5/sql/sql_connect.cc:1422
      #13 0x000055a74849cb10 in handle_one_connection (arg=0x55a74b12dfd8) at /data/src/10.5/sql/sql_connect.cc:1319
      #14 0x000055a7489cb9f3 in pfs_spawn_thread (arg=0x55a74b1bbe38) at /data/src/10.5/storage/perfschema/pfs.cc:2201
      #15 0x00007f6be5af7fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
      #16 0x00007f6be53464cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      The failure appeared in 10.5 branch with this commit:

      commit bfdd30d3e92d3bf5570cc050967098c6b5a2d73a
      Author: Sergey Vojtovich
      Date:   Sat Dec 21 01:22:09 2019 +0400
       
          Fixed close_cached_connection_tables() flushing
          
          Let DROP SERVER and ALTER SERVER perform fair affected tables flushing.
          That is acquire MDL_EXCLUSIVE and do tdc_remove_table(TDC_RT_REMOVE_ALL).
          
          Aim of this patch is elimination of another inconsistent use of
          TDC_RT_REMOVE_UNUSED. It fixes (to some extent) a problem described in the
          beginning of sql_server.cc, when close_cached_connection_tables()
          interferes with concurrent transaction.
          
          A better fix should probably introduce proper MDL locks for server
          objects?
          
          Part of MDEV-17882 - Cleanup refresh version
      

      Note: The test case is a modified excerpt from federated.federated_server.

      Attachments

        Activity

          People

            svoj Sergey Vojtovich
            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.