mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 08:36:30 +00:00
repmgrd: tweak event notifications on standby failure
The event notification was only being created if there was a valid primary connection; it should be created in any case, so an event notification script can be executed.
This commit is contained in:
@@ -999,22 +999,21 @@ loop:
|
|||||||
{
|
{
|
||||||
if (local_node_info.active == true)
|
if (local_node_info.active == true)
|
||||||
{
|
{
|
||||||
|
bool success = true;
|
||||||
|
PQExpBufferData event_details;
|
||||||
|
|
||||||
|
initPQExpBuffer(&event_details);
|
||||||
|
|
||||||
|
local_node_info.active = false;
|
||||||
|
|
||||||
|
appendPQExpBuffer(&event_details,
|
||||||
|
_("unable to connect to local node \"%s\" (ID: %i), marking inactive"),
|
||||||
|
local_node_info.node_name,
|
||||||
|
local_node_info.node_id);
|
||||||
|
log_notice("%s", event_details.data);
|
||||||
|
|
||||||
if (PQstatus(primary_conn) == CONNECTION_OK)
|
if (PQstatus(primary_conn) == CONNECTION_OK)
|
||||||
{
|
{
|
||||||
PQExpBufferData event_details;
|
|
||||||
bool success = true;
|
|
||||||
|
|
||||||
initPQExpBuffer(&event_details);
|
|
||||||
|
|
||||||
local_node_info.active = false;
|
|
||||||
|
|
||||||
appendPQExpBuffer(&event_details,
|
|
||||||
_("unable to connect to local node \"%s\" (ID: %i), marking inactive"),
|
|
||||||
local_node_info.node_name,
|
|
||||||
local_node_info.node_id);
|
|
||||||
|
|
||||||
log_notice("%s", event_details.data);
|
|
||||||
|
|
||||||
if (update_node_record_set_active(primary_conn, local_node_info.node_id, false) == false)
|
if (update_node_record_set_active(primary_conn, local_node_info.node_id, false) == false)
|
||||||
{
|
{
|
||||||
success = false;
|
success = false;
|
||||||
@@ -1022,16 +1021,16 @@ loop:
|
|||||||
local_node_info.node_name,
|
local_node_info.node_name,
|
||||||
local_node_info.node_id);
|
local_node_info.node_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
create_event_notification(primary_conn,
|
|
||||||
&config_file_options,
|
|
||||||
local_node_info.node_id,
|
|
||||||
"standby_failure",
|
|
||||||
success,
|
|
||||||
event_details.data);
|
|
||||||
|
|
||||||
termPQExpBuffer(&event_details);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
create_event_notification(primary_conn,
|
||||||
|
&config_file_options,
|
||||||
|
local_node_info.node_id,
|
||||||
|
"standby_failure",
|
||||||
|
success,
|
||||||
|
event_details.data);
|
||||||
|
|
||||||
|
termPQExpBuffer(&event_details);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user