MXS-2920: Allow max_slave_replication_lag=0

A requirement of no lag should be allowed. The reason why it wasn't was
simply due to the selection of the default value.
This commit is contained in:
Markus Mäkelä 2020-03-13 11:41:38 +02:00
parent 76e855dc1d
commit ca69da4991
No known key found for this signature in database
GPG Key ID: 5CE746D557ACC499
3 changed files with 10 additions and 2 deletions

View File

@ -502,7 +502,12 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
MXS_MODULE_OPT_NONE,
master_failure_mode_values
},
{"max_slave_replication_lag", MXS_MODULE_PARAM_DURATION, "0s", MXS_MODULE_OPT_DURATION_S},
{
"max_slave_replication_lag",
MXS_MODULE_PARAM_DURATION,
DEFAULT_MAX_SLAVE_REPLICATION_LAG_STR,
MXS_MODULE_OPT_DURATION_S
},
{"max_slave_connections", MXS_MODULE_PARAM_STRING, MAX_SLAVE_COUNT},
{"retry_failed_reads", MXS_MODULE_PARAM_BOOL, "true"},
{"prune_sescmd_history", MXS_MODULE_PARAM_BOOL, "false"},

View File

@ -124,6 +124,9 @@ static const char gtid_wait_stmt[] =
"SET @maxscale_secret_variable=(SELECT CASE WHEN %s('%s', %s) = 0 "
"THEN 1 ELSE (SELECT 1 FROM INFORMATION_SCHEMA.ENGINES) END);";
static const char DEFAULT_MAX_SLAVE_REPLICATION_LAG_STR[] = "2147483647s";
static const int DEFAULT_MAX_SLAVE_REPLICATION_LAG = 2147483647;
/** Function that returns a "score" for a server to enable comparison.
* Smaller numbers are better.
*/

View File

@ -735,7 +735,7 @@ int RWSplitSession::get_max_replication_lag()
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)
if (m_config.max_slave_replication_lag != DEFAULT_MAX_SLAVE_REPLICATION_LAG)
{
conf_max_rlag = m_config.max_slave_replication_lag;
}