MXS-2329 Use durations with persistmaxtime

This commit is contained in:
Johan Wikman 2019-04-29 12:27:51 +03:00
parent 93e130bb48
commit b1a495b342
3 changed files with 12 additions and 5 deletions

View File

@ -1573,8 +1573,14 @@ discarded will not be retained, but disconnected and discarded.
#### `persistmaxtime`
The `persistmaxtime` parameter defaults to zero but can be set to an integer
value indicating a number of seconds. A DCB placed in the persistent pool for a
The `persistmaxtime` parameter defaults to zero but can be set to a duration
as documented [here](#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
parameter is seconds, a value specified in milliseconds will be rejected,
even if the duration is longer than a second.
A DCB placed in the persistent pool for a
server will only be reused if the elapsed time since it joined the pool is less
than the given value. Otherwise, the DCB will be discarded and the connection
closed.

View File

@ -645,8 +645,9 @@ const MXS_MODULE_PARAM config_server_params[] =
},
{
CN_PERSISTMAXTIME,
MXS_MODULE_PARAM_COUNT,
"0"
MXS_MODULE_PARAM_DURATION,
"0",
MXS_MODULE_OPT_DURATION_S
},
{
CN_PROXY_PROTOCOL,

View File

@ -255,7 +255,7 @@ Server* Server::server_alloc(const char* name, MXS_CONFIG_PARAMETER* params)
server->port = params->get_integer(CN_PORT);
server->extra_port = params->get_integer(CN_EXTRA_PORT);
server->m_settings.persistpoolmax = params->get_integer(CN_PERSISTPOOLMAX);
server->m_settings.persistmaxtime = params->get_integer(CN_PERSISTMAXTIME);
server->m_settings.persistmaxtime = params->get_duration<std::chrono::seconds>(CN_PERSISTMAXTIME).count();
server->proxy_protocol = params->get_bool(CN_PROXY_PROTOCOL);
server->is_active = true;
server->m_auth_instance = auth_instance;