From 9de06a52b00943396d48ded62553c51463ef9e43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 10 Jul 2019 10:01:43 +0300 Subject: [PATCH] Allow infinite refreshes of users The hard limit of 10 seconds is too strict when taking into account the fact that infinite refreshes was possible before the bug was fixed. This also makes testing a lot easier where rapid reloads are necessary. --- Documentation/Getting-Started/Configuration-Guide.md | 6 +++++- include/maxscale/service.h | 1 - .../cnf/maxscale.cnf.template.mxs922_base | 1 + server/core/config.cc | 11 +---------- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Documentation/Getting-Started/Configuration-Guide.md b/Documentation/Getting-Started/Configuration-Guide.md index 8fb6fac7e..bb95617d8 100644 --- a/Documentation/Getting-Started/Configuration-Guide.md +++ b/Documentation/Getting-Started/Configuration-Guide.md @@ -867,13 +867,17 @@ MaxScale will at startup load the users from the backend server, but if the authentication of a user fails, MaxScale assumes it is because a new user has been created and will thus refresh the users. By default, MaxScale will do that at most once per 30 seconds and with this configuration option -that can be changed. The minimum allowed value is 10 seconds. A negative +that can be changed. A value of 0 allows infinite refreshes and a negative value disables the refreshing entirelly. Note that using `maxadmin` it is possible to explicitly cause the users of a service to be reloaded. + ``` users_refresh_time=120 ``` +In MaxScale 2.3.9 and older versions, the minimum allowed value was 10 seconds +but, due to a bug, the default value was 0 which allowed infinite refreshes. + ### `retain_last_statements` How many statements MaxScale should store for each session. This is for diff --git a/include/maxscale/service.h b/include/maxscale/service.h index e3f030a2b..dea4624df 100644 --- a/include/maxscale/service.h +++ b/include/maxscale/service.h @@ -83,7 +83,6 @@ typedef struct server_ref_t /* Refresh rate limits for load users from database */ #define USERS_REFRESH_TIME_DEFAULT 30 /* Allowed time interval (in seconds) after last update*/ -#define USERS_REFRESH_TIME_MIN 10 /* Minimum allowed time interval (in seconds)*/ /** Default timeout values used by the connections which fetch user authentication data */ #define DEFAULT_AUTH_CONNECT_TIMEOUT 3 diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.mxs922_base b/maxscale-system-test/cnf/maxscale.cnf.template.mxs922_base index 81b609976..cbb9d16ce 100644 --- a/maxscale-system-test/cnf/maxscale.cnf.template.mxs922_base +++ b/maxscale-system-test/cnf/maxscale.cnf.template.mxs922_base @@ -1,5 +1,6 @@ [maxscale] threads=###threads### +users_refresh_time=0 [rwsplit-service] type=service diff --git a/server/core/config.cc b/server/core/config.cc index 3ca07e3f6..e3d910317 100644 --- a/server/core/config.cc +++ b/server/core/config.cc @@ -2337,7 +2337,7 @@ static int handle_global_item(const char* name, const char* value) return 0; } - decltype(gateway.qc_cache_properties.max_size)max_size = int_value; + decltype(gateway.qc_cache_properties.max_size) max_size = int_value; if (max_size >= 0) { @@ -2515,15 +2515,6 @@ static int handle_global_item(const char* name, const char* value) // but I just don't beleave the uptime will be that long. users_refresh_time = INT32_MAX; } - else if (users_refresh_time < USERS_REFRESH_TIME_MIN) - { - MXS_WARNING("%s is less than the allowed minimum value of %d for the " - "configuration option '%s', using the minimum value.", - value, - USERS_REFRESH_TIME_MIN, - CN_USERS_REFRESH_TIME); - users_refresh_time = USERS_REFRESH_TIME_MIN; - } if (users_refresh_time > INT32_MAX) {