From 791640e3b4084b8f8e1aae9f9db98215789dcd86 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Wed, 2 Aug 2017 12:09:25 +0900 Subject: [PATCH] repmgrd: never execute "service_promote_command" directly --- repmgrd-physical.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/repmgrd-physical.c b/repmgrd-physical.c index 67f6fbcc..ed9613c0 100644 --- a/repmgrd-physical.c +++ b/repmgrd-physical.c @@ -113,10 +113,19 @@ do_physical_node_check(void) bool required_param_missing = false; - if (config_file_options.promote_command[0] == '\0' - && config_file_options.service_promote_command[0] == '\0') + if (config_file_options.promote_command[0] == '\0') { - log_error(_("either \"promote_command\" or \"service_promote_command\" must be defined in the configuration file")); + log_error(_("\"promote_command\" must be defined in the configuration file")); + + if (config_file_options.service_promote_command[0] != '\0') + { + /* + * if repmgrd executes "service_promote_command" directly, repmgr metadata + * won't get updated + */ + log_hint(_("\"service_promote_command\" is set, but can only be executed by \"repmgr standby promote\"")); + } + required_param_missing = true; } if (config_file_options.follow_command[0] == '\0') @@ -1143,11 +1152,8 @@ promote_self(void) return FAILOVER_STATE_PROMOTION_FAILED; } - /* the presence of either of these commands has been established already */ - if (config_file_options.service_promote_command[0] != '\0') - promote_command = config_file_options.service_promote_command; - else - promote_command = config_file_options.promote_command; + /* the presence of either of this command has been established already */ + promote_command = config_file_options.promote_command; log_debug("promote command is:\n \"%s\"", promote_command);