[MXS-2564] Rapid reconnection on server failure Created: 2019-06-14  Updated: 2019-10-03  Resolved: 2019-10-03

Status: Closed
Project: MariaDB MaxScale
Component/s: readwritesplit
Affects Version/s: 2.3.8
Fix Version/s: 2.4.3

Type: Bug Priority: Minor
Reporter: markus makela Assignee: markus makela
Resolution: Fixed Votes: 0
Labels: 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;
 }



 Comments   
Comment by markus makela [ 2019-09-19 ]

implemented the suggested solution as it is the most effective way to deal with the problem.

Generated at Thu Feb 08 04:15:03 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.