MXS-2329 Use durations in readwritesplit
This commit is contained in:
parent
ca51316364
commit
ea243fd8ba
@ -89,7 +89,14 @@ can't be used for routing.
|
||||
|
||||
This feature is disabled by default.
|
||||
|
||||
max_slave_replication_lag=<allowed lag in seconds>
|
||||
max_slave_replication_lag=<allowed lag>
|
||||
|
||||
The lag is specified as documented
|
||||
[here](../Getting-Started/Configuration-Guide.md#durations). If no explicit unit
|
||||
is provided, the value is interpreted as seconds in MaxScale 2.4. In subsequent
|
||||
versions a value without a unit may be rejected. Note that since the granularity
|
||||
of the lag is seconds, a lag specified in milliseconds will be rejected, even if
|
||||
the duration is longer than a second.
|
||||
|
||||
The Readwritesplit-router does not detect the replication lag itself. A monitor
|
||||
such as the MariaDB-monitor for a Master/Slave-cluster is required. This option
|
||||
@ -136,6 +143,13 @@ Send keepalive pings to backend servers. This feature was introduced in MaxScale
|
||||
2.2.0. The default value is 300 seconds starting with 2.3.2 and for older
|
||||
versions the feature was disabled by default.
|
||||
|
||||
The keepalive is specified as documented
|
||||
[here](../Getting-Started/Configuration-Guide.md#durations). If no explicit unit
|
||||
is provided, the value is interpreted as seconds in MaxScale 2.4. In subsequent
|
||||
versions a value without a unit may be rejected. Note that since the granularity
|
||||
of the keepalive is seconds, a keepalive specified in milliseconds will be rejected,
|
||||
even if the duration is longer than a second.
|
||||
|
||||
The parameter value is the interval in seconds between each keepalive ping. A
|
||||
keepalive ping will be sent to a backend server if the connection is idle and it
|
||||
has not been used within `n` seconds where `n` is greater than or equal to the
|
||||
@ -440,9 +454,16 @@ execution is an acceptable risk.
|
||||
|
||||
### `delayed_retry_timeout`
|
||||
|
||||
The number of seconds to wait until an error is returned to the client when
|
||||
The duration to wait until an error is returned to the client when
|
||||
`delayed_retry` is enabled. The default value is 10 seconds.
|
||||
|
||||
The timeout is specified as documented
|
||||
[here](../Getting-Started/Configuration-Guide.md#durations). If no explicit unit
|
||||
is provided, the value is interpreted as seconds in MaxScale 2.4. In subsequent
|
||||
versions a value without a unit may be rejected. Note that since the granularity
|
||||
of the timeout is seconds, a timeout specified in milliseconds will be rejected,
|
||||
even if the duration is longer than a second.
|
||||
|
||||
### `transaction_replay`
|
||||
|
||||
Replay interrupted transactions. This parameter was added in MaxScale 2.3.0 and
|
||||
@ -550,6 +571,13 @@ when the slave timed out.
|
||||
The timeout for the slave synchronization done by `causal_reads`. The
|
||||
default value is 10 seconds.
|
||||
|
||||
The timeout is specified as documented
|
||||
[here](../Getting-Started/Configuration-Guide.md#durations). If no explicit unit
|
||||
is provided, the value is interpreted as seconds in MaxScale 2.4. In subsequent
|
||||
versions a value without a unit may be rejected. Note that since the granularity
|
||||
of the timeout is seconds, a timeout specified in milliseconds will be rejected,
|
||||
even if the duration is longer than a second.
|
||||
|
||||
### `lazy_connect`
|
||||
|
||||
Lazy connection creation causes connections to backend servers to be opened only
|
||||
|
@ -504,25 +504,25 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
||||
MXS_MODULE_OPT_NONE,
|
||||
master_failure_mode_values
|
||||
},
|
||||
{"max_slave_replication_lag", MXS_MODULE_PARAM_INT, "-1" },
|
||||
{"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" },
|
||||
{"disable_sescmd_history", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{"max_sescmd_history", MXS_MODULE_PARAM_COUNT, "50" },
|
||||
{"strict_multi_stmt", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{"strict_sp_calls", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{"master_accept_reads", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{"connection_keepalive", MXS_MODULE_PARAM_COUNT, "300" },
|
||||
{"causal_reads", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{"causal_reads_timeout", MXS_MODULE_PARAM_STRING, "10" },
|
||||
{"master_reconnection", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{"delayed_retry", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{"delayed_retry_timeout", MXS_MODULE_PARAM_COUNT, "10" },
|
||||
{"transaction_replay", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{"transaction_replay_max_size",MXS_MODULE_PARAM_SIZE, "1Mi" },
|
||||
{"optimistic_trx", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{"lazy_connect", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{"max_slave_replication_lag", MXS_MODULE_PARAM_DURATION, "0s", 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" },
|
||||
{"disable_sescmd_history", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{"max_sescmd_history", MXS_MODULE_PARAM_COUNT, "50" },
|
||||
{"strict_multi_stmt", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{"strict_sp_calls", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{"master_accept_reads", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{"connection_keepalive", MXS_MODULE_PARAM_DURATION, "300s", MXS_MODULE_OPT_DURATION_S },
|
||||
{"causal_reads", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{"causal_reads_timeout", MXS_MODULE_PARAM_DURATION, "10s", MXS_MODULE_OPT_DURATION_S },
|
||||
{"master_reconnection", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{"delayed_retry", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{"delayed_retry_timeout", MXS_MODULE_PARAM_DURATION, "10s", MXS_MODULE_OPT_DURATION_S },
|
||||
{"transaction_replay", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{"transaction_replay_max_size",MXS_MODULE_PARAM_SIZE, "1Mi" },
|
||||
{"optimistic_trx", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{"lazy_connect", MXS_MODULE_PARAM_BOOL, "false" },
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
|
@ -130,6 +130,8 @@ static const char gtid_wait_stmt[] =
|
||||
using BackendSelectFunction = std::function<mxs::PRWBackends::iterator (mxs::PRWBackends& sBackends)>;
|
||||
BackendSelectFunction get_backend_select_function(select_criteria_t);
|
||||
|
||||
using std::chrono::seconds;
|
||||
|
||||
struct Config
|
||||
{
|
||||
Config(MXS_CONFIG_PARAMETER* params)
|
||||
@ -147,15 +149,15 @@ struct Config
|
||||
, strict_multi_stmt(params->get_bool("strict_multi_stmt"))
|
||||
, strict_sp_calls(params->get_bool("strict_sp_calls"))
|
||||
, retry_failed_reads(params->get_bool("retry_failed_reads"))
|
||||
, connection_keepalive(params->get_integer("connection_keepalive"))
|
||||
, max_slave_replication_lag(params->get_integer("max_slave_replication_lag"))
|
||||
, connection_keepalive(params->get_duration<seconds>("connection_keepalive").count())
|
||||
, max_slave_replication_lag(params->get_duration<seconds>("max_slave_replication_lag").count())
|
||||
, rw_max_slave_conn_percent(0)
|
||||
, max_slave_connections(0)
|
||||
, causal_reads(params->get_bool("causal_reads"))
|
||||
, causal_reads_timeout(params->get_string("causal_reads_timeout"))
|
||||
, causal_reads_timeout(std::to_string(params->get_duration<seconds>("causal_reads_timeout").count()))
|
||||
, master_reconnection(params->get_bool("master_reconnection"))
|
||||
, delayed_retry(params->get_bool("delayed_retry"))
|
||||
, delayed_retry_timeout(params->get_integer("delayed_retry_timeout"))
|
||||
, delayed_retry_timeout(params->get_duration<seconds>("delayed_retry_timeout").count())
|
||||
, transaction_replay(params->get_bool("transaction_replay"))
|
||||
, trx_max_size(params->get_size("transaction_replay_max_size"))
|
||||
, optimistic_trx(params->get_bool("optimistic_trx"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user