Avoid repeated logging when retrying automatic failover or switchover

Prevents repeated logging of similar error messages.
This commit is contained in:
Esa Korhonen
2018-08-06 14:37:59 +03:00
parent 17c84a22c7
commit 3f2838ab36
3 changed files with 108 additions and 88 deletions

View File

@ -24,7 +24,7 @@
#include <string>
#include <maxscale/json_api.h>
/** Utility macro for printing both MXS_ERROR and json error */
/** Utility macros for printing both MXS_ERROR and json error */
#define PRINT_MXS_JSON_ERROR(err_out, format, ...)\
do {\
MXS_ERROR(format, ##__VA_ARGS__);\
@ -34,6 +34,12 @@
}\
} while (false)
#define PRINT_ERROR_IF(log_mode, err_out, format, ...)\
if (log_mode == Log::ON)\
{\
PRINT_MXS_JSON_ERROR(err_out, format, ##__VA_ARGS__);\
}\
extern const int64_t SERVER_ID_UNKNOWN;
extern const int64_t GTID_DOMAIN_UNKNOWN;
extern const int PORT_UNKNOWN;
@ -64,4 +70,10 @@ enum class ClusterOperation
{
SWITCHOVER,
FAILOVER
};
};
enum class Log
{
OFF,
ON
};