diff --git a/Documentation/Getting-Started/Configuration-Guide.md b/Documentation/Getting-Started/Configuration-Guide.md index 45ab3bd99..d54451735 100644 --- a/Documentation/Getting-Started/Configuration-Guide.md +++ b/Documentation/Getting-Started/Configuration-Guide.md @@ -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. diff --git a/server/core/config.cc b/server/core/config.cc index d158a21ea..736963e97 100644 --- a/server/core/config.cc +++ b/server/core/config.cc @@ -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, diff --git a/server/core/server.cc b/server/core/server.cc index 42b27007f..b35af0b22 100644 --- a/server/core/server.cc +++ b/server/core/server.cc @@ -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(CN_PERSISTMAXTIME).count(); server->proxy_protocol = params->get_bool(CN_PROXY_PROTOCOL); server->is_active = true; server->m_auth_instance = auth_instance;