MXS-2919: Don't use slaves with unknown lag

If a limit on the replication lag is configured, servers with unmeasured
replication lag should not be used. The code in question did use them even
when a limit was set as the value used for undefined lag was -1 which
always measured lower than the limit.
This commit is contained in:
Markus Mäkelä 2020-03-13 11:23:01 +02:00
parent 2eeb583245
commit 76e855dc1d
No known key found for this signature in database
GPG Key ID: 5CE746D557ACC499

View File

@ -472,5 +472,6 @@ std::string extract_error(GWBUF* buffer);
*/
static inline bool rpl_lag_is_ok(mxs::RWBackend* backend, int max_rlag)
{
return max_rlag == SERVER::RLAG_UNDEFINED || backend->server()->rlag <= max_rlag;
auto rlag = backend->server()->rlag;
return max_rlag == SERVER::RLAG_UNDEFINED || (rlag != SERVER::RLAG_UNDEFINED && rlag <= max_rlag);
}