From 4fe71b41ed03e23facec4b5004c1704253e8389f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 3 Jul 2020 08:28:33 +0300 Subject: [PATCH] MXS-3038: Don't connect to lagging slaves There's no use connecting to a lagging slave if a replication lag limit has been set. --- .../modules/routing/readwritesplit/rwsplit_select_backends.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/modules/routing/readwritesplit/rwsplit_select_backends.cc b/server/modules/routing/readwritesplit/rwsplit_select_backends.cc index 3ed4172b0..4f5439990 100644 --- a/server/modules/routing/readwritesplit/rwsplit_select_backends.cc +++ b/server/modules/routing/readwritesplit/rwsplit_select_backends.cc @@ -507,7 +507,8 @@ bool RWSplitSession::open_connections() for (auto& backend : m_raw_backends) { if (!backend->in_use() && backend->can_connect() && valid_for_slave(backend, master) - && backend->server()->rank() == current_rank) + && backend->server()->rank() == current_rank + && rpl_lag_is_ok(backend, get_max_replication_lag())) { candidates.push_back(backend); }