From 109702ee72b12b1cef5b16aaaf14f9c6e6514c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 13 Mar 2019 10:41:33 +0200 Subject: [PATCH] Fix replication lag calculation in readwritesplit The value used to represent the lack of a configured replication lag was different than was used in other parts of MaxScale. --- server/modules/routing/readwritesplit/rwsplit_route_stmt.cc | 6 +----- .../routing/readwritesplit/rwsplit_select_backends.cc | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc index 8eff6ec3e..087540241 100644 --- a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc +++ b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc @@ -738,17 +738,13 @@ RWBackend* RWSplitSession::get_target_backend(backend_type_t btype, */ int RWSplitSession::get_max_replication_lag() { - int conf_max_rlag; + int conf_max_rlag = SERVER::RLAG_UNDEFINED; /** if there is no configured value, then longest possible int is used */ if (m_config.max_slave_replication_lag > 0) { conf_max_rlag = m_config.max_slave_replication_lag; } - else - { - conf_max_rlag = ~(1 << 31); - } return conf_max_rlag; } diff --git a/server/modules/routing/readwritesplit/rwsplit_select_backends.cc b/server/modules/routing/readwritesplit/rwsplit_select_backends.cc index cbcbb8bf2..30d5eb31f 100644 --- a/server/modules/routing/readwritesplit/rwsplit_select_backends.cc +++ b/server/modules/routing/readwritesplit/rwsplit_select_backends.cc @@ -265,7 +265,7 @@ RWBackend* RWSplitSession::get_slave_backend(int max_rlag) } } - if (max_rlag > 0) + if (max_rlag != SERVER::RLAG_UNDEFINED) { auto state = rlag_ok ? SERVER::RLagState::ABOVE_LIMIT : SERVER::RLagState::BELOW_LIMIT; backend->change_rlag_state(state, max_rlag);