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

galera_connect.inc sleeps one second on each invocation

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • None
    • None
    • Galera, Tests, MTR
    • None

    Description

      MTR macro galera_concurrent.inc sleeps one second, unconditionally, on every invocation. This makes a two node test take at least two seconds, at minimum, no matter what the actual test does.

      # Temporal solution to avoid concurrent IST MDEV-7178
      --sleep 1
      

      With ~700 tests in Galera/wsrep suites, the approximate cost is total of ~1400 seconds of sleeping in full MTR run.

      Suggested improvement: Replace sleep with wait for Synced state

      diff --git a/mysql-test/include/galera_connect.inc b/mysql-test/include/galera_c
      onnect.inc
      index 5e72cf9ed23..aa1521caa74 100644
      --- a/mysql-test/include/galera_connect.inc
      +++ b/mysql-test/include/galera_connect.inc
      @@ -20,6 +20,14 @@
       # $galera_debug
       #   Print debug information.
       #
      +# $galera_wait_synced
      +#   If set, wait for the node to reach the 'Synced' state after connecting.
      +#   This is a one-shot flag: it is cleared at the end of this include, so it
      +#   must be set before every source. Callers that connect to a node which is
      +#   expected to become Synced (e.g. galera_init.inc during cluster bring-up)
      +#   should set it; callers that connect to a node in a non-Primary, donor or
      +#   otherwise desynced state must leave it unset.
      +#
       
       if (!$galera_connection_name)
       {
      @@ -50,10 +58,41 @@ if ($galera_debug)
       --enable_query_log
       }
       
      -# Temporal solution to avoid concurrent IST MDEV-7178
      ---sleep 1
      -
       # Open a connection
       --disable_query_log
       --connect($galera_connection_name,$galera_connection_address,root,,test,$_galera_port,)
       --enable_query_log
      +
      +if ($galera_wait_synced)
      +{
      +  --disable_query_log
      +  --disable_result_log
      +  --enable_reconnect
      +  let $wait_counter = 600;
      +  while ($wait_counter)
      +  {
      +    --disable_abort_on_error
      +    let $synced = `SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'`;
      +    --enable_abort_on_error
      +    if ($synced)
      +    {
      +      let $wait_counter = 0;
      +    }
      +    if (!$synced)
      +    {
      +      real_sleep 0.1;
      +      dec $wait_counter;
      +    }
      +  }
      +  --disable_reconnect
      +  --enable_query_log
      +  --enable_result_log
      +
      +  if (!$synced)
      +  {
      +    --die Node $galera_connection_name did not reach Synced state in galera_connect.inc
      +  }
      +}
      +
      +# Clear the one-shot flag so it does not leak to later galera_connect.inc calls.
      +--let $galera_wait_synced= 0
      diff --git a/mysql-test/include/galera_init.inc b/mysql-test/include/galera_init.inc
      index 79591973862..1105ef7b0ce 100644
      --- a/mysql-test/include/galera_init.inc
      +++ b/mysql-test/include/galera_init.inc
      @@ -19,6 +19,8 @@ while ($_galera_node)
       {
         --let $galera_connection_name= node_$_galera_node
         --let $galera_server_number= $_galera_node
      +  # During bring-up every node is expected to become Synced.
      +  --let $galera_wait_synced= 1
         --source include/galera_connect.inc
       
         --dec $_galera_node
      

      Attachments

        Issue Links

          Activity

            People

              teemu.ollakka Teemu Ollakka
              teemu.ollakka Teemu Ollakka
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.