repmgrd: add configuration option "always_promote"

In certain corner cases, it's possible repmgrd may end up monitoring
a standby which was a former primary, but the node record has not
yet been updated.

Previously repmgrd would abort the promotion with a cryptic message
about being unable to find a node record for node_id -1 (the
default value for an unknown node id).

This commit addes a new configuration option "always_promote", which
determines whether repmgrd should promote the node in this case.
The default is "false", to effectively maintain the existing behaviour.

Logging output has also been improved to make it clearer what has
happened when this situation occurs.
This commit is contained in:
Ian Barwick
2020-09-29 14:13:03 +09:00
parent 16eeae700c
commit ce229beff8
8 changed files with 130 additions and 11 deletions

View File

@@ -867,6 +867,7 @@ parse_time_unit_parameter(const char *name, const char *value, char *dest, ItemL
* - monitoring_history
* - primary_notification_timeout
* - primary_visibility_consensus
* - always_promote
* - promote_command
* - reconnect_attempts
* - reconnect_interval
@@ -1239,6 +1240,15 @@ reload_config(t_server_type server_type)
format_bool(config_file_options.primary_visibility_consensus));
}
/* always_promote */
if (config_file_options.always_promote != orig_config_file_options.always_promote)
{
item_list_append_format(&config_changes,
_("\"always_promote\" changed from \"%s\" to \"%s\""),
format_bool(orig_config_file_options.always_promote),
format_bool(config_file_options.always_promote));
}
/* failover_validation_command */
if (strncmp(config_file_options.failover_validation_command, orig_config_file_options.failover_validation_command, sizeof(config_file_options.failover_validation_command)) != 0)
{