repmgrd: document standby_[failure|recovery] event notifications

Also clean up the relevant code section.

Addresses GitHub #359.
This commit is contained in:
Ian Barwick
2018-01-04 09:33:37 +09:00
parent 5d8ec136e6
commit e64d965c6a
2 changed files with 19 additions and 16 deletions

View File

@@ -121,6 +121,7 @@
<para> <para>
By default, all notification types will be passed to the designated script; By default, all notification types will be passed to the designated script;
the notification types can be filtered to explicitly named ones: the notification types can be filtered to explicitly named ones:
<itemizedlist spacing="compact" mark="bullet"> <itemizedlist spacing="compact" mark="bullet">
<listitem> <listitem>
@@ -147,6 +148,12 @@
<listitem> <listitem>
<simpara><literal>standby_disconnect_manual</literal></simpara> <simpara><literal>standby_disconnect_manual</literal></simpara>
</listitem> </listitem>
<listitem>
<simpara><literal>standby_failure</literal></simpara>
</listitem>
<listitem>
<simpara><literal>standby_recovery</literal></simpara>
</listitem>
<listitem> <listitem>
<simpara><literal>witness_register</literal></simpara> <simpara><literal>witness_register</literal></simpara>
</listitem> </listitem>

View File

@@ -1,5 +1,5 @@
/* /*
* repmgrd-physical.c - physical replication functionality for repmgrd * repmgrd-physical.c - physical (streaming) replication functionality for repmgrd
* *
* Copyright (c) 2ndQuadrant, 2010-2018 * Copyright (c) 2ndQuadrant, 2010-2018
* *
@@ -107,11 +107,11 @@ do_physical_node_check(void)
if (local_node_info.active == false) if (local_node_info.active == false)
{ {
char *hint = "Check that 'repmgr (primary|standby) register' was executed for this node"; char *hint = "Check that \"repmgr (primary|standby) register\" was executed for this node";
switch (config_file_options.failover) switch (config_file_options.failover)
{ {
/* "failover" is an enum, all values should be covered here */ /* "failover" is an enum, all values should be covered here */
case FAILOVER_AUTOMATIC: case FAILOVER_AUTOMATIC:
log_error(_("this node is marked as inactive and cannot be used as a failover target")); log_error(_("this node is marked as inactive and cannot be used as a failover target"));
@@ -935,22 +935,19 @@ loop:
local_node_info.active = false; local_node_info.active = false;
appendPQExpBuffer( appendPQExpBuffer(&event_details,
&event_details,
_("unable to connect to local node \"%s\" (ID: %i), marking inactive"), _("unable to connect to local node \"%s\" (ID: %i), marking inactive"),
local_node_info.node_name, local_node_info.node_name,
local_node_info.node_id); local_node_info.node_id);
log_warning("%s", event_details.data) log_warning("%s", event_details.data);
create_event_notification(primary_conn,
create_event_notification( &config_file_options,
primary_conn, local_node_info.node_id,
&config_file_options, "standby_failure",
local_node_info.node_id, false,
"standby_failure", event_details.data);
false,
event_details.data);
termPQExpBuffer(&event_details); termPQExpBuffer(&event_details);
} }
@@ -971,8 +968,7 @@ loop:
local_node_info.active = true; local_node_info.active = true;
appendPQExpBuffer( appendPQExpBuffer(&event_details,
&event_details,
_("reconnected to local node \"%s\" (ID: %i), marking active"), _("reconnected to local node \"%s\" (ID: %i), marking active"),
local_node_info.node_name, local_node_info.node_name,
local_node_info.node_id); local_node_info.node_id);