From 840b4b24bd048ed536621d4433abbb4e846dfcc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 30 Jan 2019 13:01:15 +0200 Subject: [PATCH] MXS-2300: Fix off-by-one bug in history size The history was one command shorter than what was configured. --- server/modules/routing/readwritesplit/rwsplit_route_stmt.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc index 87ae8192e..b12e33954 100644 --- a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc +++ b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc @@ -517,7 +517,7 @@ bool RWSplitSession::route_session_write(GWBUF* querybuf, uint8_t command, uint3 } } - if (m_config.max_sescmd_history > 0 && m_sescmd_list.size() >= m_config.max_sescmd_history) + if (m_config.max_sescmd_history > 0 && m_sescmd_list.size() > m_config.max_sescmd_history) { static bool warn_history_exceeded = true; if (warn_history_exceeded) @@ -540,7 +540,7 @@ bool RWSplitSession::route_session_write(GWBUF* querybuf, uint8_t command, uint3 } if (m_config.prune_sescmd_history && !m_sescmd_list.empty() - && m_sescmd_list.size() + 1 >= m_config.max_sescmd_history) + && m_sescmd_list.size() + 1 > m_config.max_sescmd_history) { // Close to the history limit, remove the oldest command prune_to_position(m_sescmd_list.front()->get_position());