From 3fc20d434588c0c3125986d94243f11ef634ccfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 12 Feb 2020 07:57:42 +0200 Subject: [PATCH] MXS-2822: Use both last_write and last_read The code relied on last_read for the idle time calculation which caused the pings that were written to not reset the idle time. This increased the chance of multiple COM_PING packets being sent to a backend before a reply was received. --- server/modules/routing/readwritesplit/rwsplit_route_stmt.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc index 58d2e0b16..9cf22957e 100644 --- a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc +++ b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc @@ -51,7 +51,7 @@ void RWSplitSession::handle_connection_keepalive(RWBackend* target) if (backend->in_use() && backend != target && !backend->is_waiting_result()) { MXB_AT_DEBUG(nserv++); - int64_t diff = now - backend->dcb()->last_read; + int64_t diff = now - std::max(backend->dcb()->last_read, backend->dcb()->last_write); if (diff > keepalive) {