MXS-2329 Use durations in ccrfilter
The time window of the ccrfilter is now specified as a duration. Internally, the time window is still always handled as seconds.
This commit is contained in:
@ -57,8 +57,13 @@ The CCR filter has no mandatory parameters.
|
|||||||
|
|
||||||
### `time`
|
### `time`
|
||||||
|
|
||||||
The time window in seconds during which queries are routed to the master. The
|
The time window during which queries are routed to the master. The duration
|
||||||
default value for this parameter is 60 seconds.
|
can be specified as documented
|
||||||
|
[here](Getting-Started/Configuration-Guide.md#durations)
|
||||||
|
but the value will always be rounded to the nearest second.
|
||||||
|
If no explicit unit has been specified, the value is interpreted as seconds
|
||||||
|
in MaxScale 2.4. In subsequent versions a value without a unit may be rejected.
|
||||||
|
The default value for this parameter is 60 seconds.
|
||||||
|
|
||||||
When a data modifying SQL statement is processed, a timer is set to the value of
|
When a data modifying SQL statement is processed, a timer is set to the value of
|
||||||
_time_. Once the timer has elapsed, all statements are routed normally. If a new
|
_time_. Once the timer has elapsed, all statements are routed normally. If a new
|
||||||
|
@ -90,7 +90,9 @@ public:
|
|||||||
if (new_instance)
|
if (new_instance)
|
||||||
{
|
{
|
||||||
new_instance->m_count = params->get_integer("count");
|
new_instance->m_count = params->get_integer("count");
|
||||||
new_instance->m_time = params->get_integer("time");
|
new_instance->m_time = params->get_duration("time", mxs::config::INTERPRET_AS_SECONDS).count();
|
||||||
|
// The window is in seconds.
|
||||||
|
new_instance->m_time = std::lround(new_instance->m_time / 1000.0);
|
||||||
new_instance->m_match = params->get_string(PARAM_MATCH);
|
new_instance->m_match = params->get_string(PARAM_MATCH);
|
||||||
new_instance->m_nomatch = params->get_string(PARAM_IGNORE);
|
new_instance->m_nomatch = params->get_string(PARAM_IGNORE);
|
||||||
|
|
||||||
@ -345,11 +347,11 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
|||||||
NULL, /* Thread init. */
|
NULL, /* Thread init. */
|
||||||
NULL, /* Thread finish. */
|
NULL, /* Thread finish. */
|
||||||
{
|
{
|
||||||
{"count", MXS_MODULE_PARAM_COUNT, "0" },
|
{"count", MXS_MODULE_PARAM_COUNT, "0"},
|
||||||
{"time", MXS_MODULE_PARAM_COUNT, "60" },
|
{"time", MXS_MODULE_PARAM_DURATION, "60s"},
|
||||||
{PARAM_MATCH, MXS_MODULE_PARAM_REGEX},
|
{PARAM_MATCH, MXS_MODULE_PARAM_REGEX},
|
||||||
{PARAM_IGNORE, MXS_MODULE_PARAM_REGEX},
|
{PARAM_IGNORE, MXS_MODULE_PARAM_REGEX},
|
||||||
{"options", MXS_MODULE_PARAM_ENUM, "ignorecase", MXS_MODULE_OPT_NONE, option_values},
|
{"options", MXS_MODULE_PARAM_ENUM, "ignorecase", MXS_MODULE_OPT_NONE, option_values},
|
||||||
{MXS_END_MODULE_PARAMS}
|
{MXS_END_MODULE_PARAMS}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user