From 21153227379387fd9cc93cc3eb9363d3b3d5dd7c Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 30 Apr 2019 10:24:12 +0300 Subject: [PATCH] MXS-2329 Change warning into info Currently it's too laborious to use duration suffixes when saving generated configs and also to handle suffixes when changes are made dynamically using maxctrl. It will be trivial to do that when the new configuration mechanism has been taken into use everywhere. That will not happen before MaxScale 2.5. So, in MaxScale 2.4 duration suffixes will be accepted in manually created configuration files, but no warning will be logged if a suffix is not used. --- .../MaxScale-2.4.0-Release-Notes.md | 3 ++- server/core/config.cc | 26 +++++++++---------- .../modules/routing/binlogrouter/blr_file.cc | 4 +-- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Documentation/Release-Notes/MaxScale-2.4.0-Release-Notes.md b/Documentation/Release-Notes/MaxScale-2.4.0-Release-Notes.md index 8bbf3fea7..119cb4411 100644 --- a/Documentation/Release-Notes/MaxScale-2.4.0-Release-Notes.md +++ b/Documentation/Release-Notes/MaxScale-2.4.0-Release-Notes.md @@ -128,7 +128,8 @@ Please see the [configuration guide](../Getting-Started/Configuration-Guide.md#durations) for details. -_Not_ providing an explicit unit has been deprecated in MaxScale 2.4. +_Not_ providing an explicit unit is strongly discouraged as it will be +deprecated in MaxScale 2.5. ### Query Classifier Cache diff --git a/server/core/config.cc b/server/core/config.cc index 2437a8aa7..f3c443efb 100644 --- a/server/core/config.cc +++ b/server/core/config.cc @@ -247,7 +247,7 @@ static bool get_milliseconds(const char* zName, const char* zValue, const char* zDisplay_value, time_t* pMilliseconds); - +static void log_duration_suffix_warning(const char* zName, const char* zValue); int config_get_ifaddr(unsigned char* output); static int config_get_release_string(char* release); @@ -4513,11 +4513,7 @@ bool config_param_is_valid(const MXS_MODULE_PARAM* params, break; case mxs::config::DURATION_IN_DEFAULT: - MXS_WARNING("Specifying durations without a suffix denoting the unit " - "has been deprecated: '%s=%s'. Use the suffixes 'h' (hour), " - "'m' (minute) 's' (second) or 'ms' (milliseconds). " - "For instance, '%s=%ss' or '%s=%sms.", - key, value, key, value, key, value); + log_duration_suffix_warning(key, value); break; default: @@ -5143,6 +5139,14 @@ static bool duration_is_valid(const char* zValue, mxs::config::DurationUnit* pUn return valid; } +static void log_duration_suffix_warning(const char* zName, const char* zValue) +{ + MXS_INFO("Specifying durations without a suffix denoting the unit " + "is strongly discouraged as it will be deprecated in the " + "future: %s=%s. Use the suffixes 'h' (hour), 'm' (minute), " + "'s' (second) or 'ms' (milliseconds).", zName, zValue); +} + static bool get_seconds(const char* zName, const char* zValue, std::chrono::seconds* pSeconds) { bool valid = false; @@ -5160,9 +5164,7 @@ static bool get_seconds(const char* zName, const char* zValue, std::chrono::seco break; case mxs::config::DURATION_IN_DEFAULT: - MXS_WARNING("Specifying durations without a suffix denoting the unit " - "has been deprecated: %s=%s. Use the suffixes 'h' (hour), " - "'m' (minute) 's' (second) or 'ms' (milliseconds).", zName, zValue); + log_duration_suffix_warning(zName, zValue); default: *pSeconds = seconds; valid = true; @@ -5170,7 +5172,7 @@ static bool get_seconds(const char* zName, const char* zValue, std::chrono::seco } else { - MXS_ERROR("Invalid timeout value for '%s': %s", zName, zValue); + MXS_ERROR("Invalid duration %s: %s=%s", zValue, zName, zValue); } return valid; @@ -5208,9 +5210,7 @@ static bool get_milliseconds(const char* zName, { if (unit == mxs::config::DURATION_IN_DEFAULT) { - MXS_WARNING("Specifying durations without a suffix denoting the unit " - "has been deprecated: %s=%s. Use the suffixes 'h' (hour), " - "'m' (minute) 's' (second) or 'ms' (milliseconds).", zName, zDisplay_value); + log_duration_suffix_warning(zName, zDisplay_value); } *pMilliseconds = milliseconds; diff --git a/server/modules/routing/binlogrouter/blr_file.cc b/server/modules/routing/binlogrouter/blr_file.cc index c28093c9b..112e2e77a 100644 --- a/server/modules/routing/binlogrouter/blr_file.cc +++ b/server/modules/routing/binlogrouter/blr_file.cc @@ -3383,8 +3383,8 @@ void write_master_config(FILE* config_file, const ChangeMasterConfig& config) fprintf(config_file, "master_tls_version=%s\n", config.ssl_version.c_str()); } - fprintf(config_file, "master_heartbeat_period=%ds\n", config.heartbeat_period); - fprintf(config_file, "master_connect_retry=%ds\n", config.connect_retry); + fprintf(config_file, "master_heartbeat_period=%d\n", config.heartbeat_period); + fprintf(config_file, "master_connect_retry=%d\n", config.connect_retry); } }