MXS-2329 Use durations in schema router

This commit is contained in:
Johan Wikman
2019-04-29 13:48:37 +03:00
parent ea243fd8ba
commit aa3057695b
3 changed files with 18 additions and 10 deletions

View File

@ -200,6 +200,13 @@ change the database i.e. `USE ...` queries.
The minimum interval between database map refreshes in seconds. The minimum interval between database map refreshes in seconds.
The interval 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 intervaltimeout is seconds, a timeout specified in milliseconds will be rejected,
even if the duration is longer than a second.
## Limitations ## Limitations
1. Cross-database queries (e.g. `SELECT column FROM database1.table UNION select column 1. Cross-database queries (e.g. `SELECT column FROM database1.table UNION select column

View File

@ -19,7 +19,7 @@ namespace schemarouter
{ {
Config::Config(MXS_CONFIG_PARAMETER* conf) Config::Config(MXS_CONFIG_PARAMETER* conf)
: refresh_min_interval(conf->get_integer("refresh_interval")) : refresh_min_interval(conf->get_duration<std::chrono::seconds>("refresh_interval").count())
, refresh_databases(conf->get_bool("refresh_databases")) , refresh_databases(conf->get_bool("refresh_databases"))
, debug(conf->get_bool("debug")) , debug(conf->get_bool("debug"))
, ignore_regex(conf->get_compiled_regex("ignore_databases_regex", 0, NULL).release()) , ignore_regex(conf->get_compiled_regex("ignore_databases_regex", 0, NULL).release())

View File

@ -34,7 +34,7 @@ using std::string;
namespace schemarouter namespace schemarouter
{ {
#define DEFAULT_REFRESH_INTERVAL "300" #define DEFAULT_REFRESH_INTERVAL "300s"
/** /**
* @file schemarouter.c The entry points for the simple sharding router module. * @file schemarouter.c The entry points for the simple sharding router module.
@ -299,7 +299,8 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
{"max_sescmd_history", MXS_MODULE_PARAM_COUNT, "0"}, {"max_sescmd_history", MXS_MODULE_PARAM_COUNT, "0"},
{"disable_sescmd_history", MXS_MODULE_PARAM_BOOL, "false"}, {"disable_sescmd_history", MXS_MODULE_PARAM_BOOL, "false"},
{"refresh_databases", MXS_MODULE_PARAM_BOOL, "true"}, {"refresh_databases", MXS_MODULE_PARAM_BOOL, "true"},
{"refresh_interval", MXS_MODULE_PARAM_COUNT, DEFAULT_REFRESH_INTERVAL}, {"refresh_interval", MXS_MODULE_PARAM_DURATION, DEFAULT_REFRESH_INTERVAL,
MXS_MODULE_OPT_DURATION_S },
{"debug", MXS_MODULE_PARAM_BOOL, "false"}, {"debug", MXS_MODULE_PARAM_BOOL, "false"},
{"preferred_server", MXS_MODULE_PARAM_SERVER }, {"preferred_server", MXS_MODULE_PARAM_SERVER },
{MXS_END_MODULE_PARAMS} {MXS_END_MODULE_PARAMS}