repmgrd: tweak log notices when marking a standby as failed

Announce what we're going to do (set the node record inactive) *before*
performing the action. Makes reading the log slightly easier.
This commit is contained in:
Ian Barwick
2018-03-23 13:27:37 +08:00
parent b4272853e7
commit 7e2af17783

View File

@@ -1002,10 +1002,9 @@ loop:
if (local_node_info.active == true) if (local_node_info.active == true)
{ {
if (PQstatus(primary_conn) == CONNECTION_OK) if (PQstatus(primary_conn) == CONNECTION_OK)
{
if (update_node_record_set_active(primary_conn, local_node_info.node_id, false) == true)
{ {
PQExpBufferData event_details; PQExpBufferData event_details;
bool success = true;
initPQExpBuffer(&event_details); initPQExpBuffer(&event_details);
@@ -1016,20 +1015,27 @@ loop:
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_notice("%s", event_details.data);
if (update_node_record_set_active(primary_conn, local_node_info.node_id, false) == false)
{
success = false;
log_warning(_("unable to mark node \"%s\" (ID: %i) as inactive"),
local_node_info.node_name,
local_node_info.node_id);
}
create_event_notification(primary_conn, create_event_notification(primary_conn,
&config_file_options, &config_file_options,
local_node_info.node_id, local_node_info.node_id,
"standby_failure", "standby_failure",
false, success,
event_details.data); event_details.data);
termPQExpBuffer(&event_details); termPQExpBuffer(&event_details);
} }
} }
} }
}
else else
{ {
if (local_node_info.active == false) if (local_node_info.active == false)