From 4c2c8ecbab7c378aa774ecbc0238ce15c578f0ba Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Wed, 20 Mar 2019 11:58:18 +0900 Subject: [PATCH] Fix logging related to "connection_check_type" Also log the selected type at repmgrd startup. --- configfile.c | 22 ++++++++++++++++++++-- configfile.h | 1 + repmgrd.c | 2 ++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/configfile.c b/configfile.c index 2601a60b..5995bc84 100644 --- a/configfile.c +++ b/configfile.c @@ -645,7 +645,7 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList * else { item_list_append(error_list, - _("value for \"connection_check_type\" must be \"ping\" or \"connection\"\n")); + _("value for \"connection_check_type\" must be \"ping\", \"connection\" or \"query\"\n")); } } else if (strcmp(name, "primary_visibility_consensus") == 0) @@ -1398,7 +1398,7 @@ reload_config(t_configuration_options *orig_options, t_server_type server_type) { orig_options->connection_check_type = new_options.connection_check_type; log_info(_("\"connection_check_type\" is now \"%s\""), - new_options.connection_check_type == CHECK_PING ? "ping" : "connection"); + print_connection_check_type(new_options.connection_check_type)); config_changed = true; } @@ -2017,3 +2017,21 @@ parse_pg_basebackup_options(const char *pg_basebackup_options, t_basebackup_opti return backup_options_ok; } + + +const char * +print_connection_check_type(ConnectionCheckType type) +{ + switch (type) + { + case CHECK_PING: + return "ping"; + case CHECK_QUERY: + return "query"; + case CHECK_CONNECTION: + return "connection"; + } + + /* should never reach here */ + return "UNKNOWN"; +} diff --git a/configfile.h b/configfile.h index ed13e245..ab82174d 100644 --- a/configfile.h +++ b/configfile.h @@ -329,5 +329,6 @@ void free_parsed_argv(char ***argv_array); /* called by repmgr-client and repmgrd */ void exit_with_cli_errors(ItemList *error_list, const char *repmgr_command); void print_item_list(ItemList *item_list); +const char *print_connection_check_type(ConnectionCheckType type); #endif /* _REPMGR_CONFIGFILE_H_ */ diff --git a/repmgrd.c b/repmgrd.c index a86a7189..d9673ef7 100644 --- a/repmgrd.c +++ b/repmgrd.c @@ -561,6 +561,8 @@ start_monitoring(void) local_node_info.node_name, local_node_info.node_id); + log_info(_("\"connection_check_type\" set to \"%s\""), print_connection_check_type(config_file_options.connection_check_type)); + while (true) { switch (local_node_info.type)