doc: update documentation of "promote_command" and "service_promote_command"

The documentation implied it would override "promote_command", which is
not the case.

"promote_command" is used by repmgrd to execute "repmgr standby promote"
(either directly or via a custom script).

"service_promote_command" can be set to specify a package-level service
command to promote the local PostgreSQL instance from standby to primary,
e.g. Debian's pg_ctlcluster. If set, this will be executed by "repmgr standby promote".

Also update code comments to clarify usage.

Related to GitHub #473.
This commit is contained in:
Ian Barwick
2018-07-16 14:40:04 +09:00
parent 69782cf703
commit 63242e2277
4 changed files with 52 additions and 22 deletions

View File

@@ -162,8 +162,8 @@ do_physical_node_check(void)
if (config_file_options.failover == FAILOVER_AUTOMATIC)
{
/*
* check that promote/follow commands are defined, otherwise repmgrd
* won't be able to perform any useful action
* Check that "promote_command" and "follow_command" are defined, otherwise repmgrd
* won't be able to perform any useful action in a failover situation.
*/
bool required_param_missing = false;
@@ -175,14 +175,24 @@ do_physical_node_check(void)
if (config_file_options.service_promote_command[0] != '\0')
{
/*
* if repmgrd executes "service_promote_command" directly,
* repmgr metadata won't get updated
* "service_promote_command" is *not* a substitute for "promote_command";
* it is intended for use in those systems (e.g. Debian) where there's a service
* level promote command (e.g. pg_ctlcluster).
*
* "promote_command" should either execute "repmgr standby promote" directly, or
* a script which executes "repmgr standby promote". This is essential, as the
* repmgr metadata is updated by "repmgr standby promote".
*
* "service_promote_command", if set, will be executed by "repmgr standby promote",
* but never by repmgrd.
*
*/
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')
{
log_error(_("\"follow_command\" must be defined in the configuration file"));
@@ -2063,7 +2073,7 @@ promote_self(void)
return FAILOVER_STATE_PROMOTION_FAILED;
}
/* the presence of either of this command has been established already */
/* the presence of this command has been established already */
promote_command = config_file_options.promote_command;
log_debug("promote command is:\n \"%s\"",