Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-2564

Rapid reconnection on server failure

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 2.3.8
    • 2.4.3
    • readwritesplit
    • None

    Description

      When a server fails and a monitor has not yet noticed it, readwritesplit will try to reconnect to it. If the server in question is shutting down, this will cause repeated reconnections to take place. This can be avoided by adding a minimal reconnection delay or by simply removing reconnection on server errors and only creating new connections when queries are being routed.

      The following patch would solve it by removing the "offending" code. The downside of this is that broken connections would not get reinstated as fast as they currently are.

      diff --git a/server/modules/routing/readwritesplit/rwsplitsession.cc b/server/modules/routing/readwritesplit/rwsplitsession.cc
      index 44b9ea0ff..fc49a62aa 100644
      --- a/server/modules/routing/readwritesplit/rwsplitsession.cc
      +++ b/server/modules/routing/readwritesplit/rwsplitsession.cc
      @@ -1146,13 +1146,13 @@ bool RWSplitSession::handle_error_new_connection(DCB* backend_dcb, GWBUF* errmsg
               route_stored_query();
           }
       
      -    bool succp = false;
      -    /**
      -     * Try to get replacement slave or at least the minimum
      -     * number of slave connections for router session.
      -     */
      +    bool succp = true;
      +
           if (m_recv_sescmd > 0 && m_config.disable_sescmd_history)
           {
      +        // Session command history is disabled: if an open connection exists, the session can continue
      +        succp = false;
      +
               for (const auto& a : m_backends)
               {
                   if (a->in_use())
      @@ -1168,15 +1168,6 @@ bool RWSplitSession::handle_error_new_connection(DCB* backend_dcb, GWBUF* errmsg
                             "last server to fail was '%s'.", backend->name());
               }
           }
      -    else
      -    {
      -        succp = m_router->select_connect_backend_servers(ses,
      -                                                         m_backends,
      -                                                         m_current_master,
      -                                                         &m_sescmd_list,
      -                                                         &m_expected_responses,
      -                                                         connection_type::SLAVE);
      -    }
       
           return succp;
       }
      

      Attachments

        Activity

          People

            markus makela markus makela
            markus makela markus makela
            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.