mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
repmgrd: improve logging output when executing "failover_validate_command"
This commit is contained in:
15
repmgr.c
15
repmgr.c
@@ -53,6 +53,7 @@
|
|||||||
#include "voting.h"
|
#include "voting.h"
|
||||||
|
|
||||||
#define UNKNOWN_NODE_ID -1
|
#define UNKNOWN_NODE_ID -1
|
||||||
|
#define ELECTION_RERUN_NOTIFICATION -2
|
||||||
#define UNKNOWN_PID -1
|
#define UNKNOWN_PID -1
|
||||||
|
|
||||||
#define TRANCHE_NAME "repmgrd"
|
#define TRANCHE_NAME "repmgrd"
|
||||||
@@ -441,9 +442,17 @@ notify_follow_primary(PG_FUNCTION_ARGS)
|
|||||||
/* only do something if local_node_id is initialised */
|
/* only do something if local_node_id is initialised */
|
||||||
if (shared_state->local_node_id != UNKNOWN_NODE_ID)
|
if (shared_state->local_node_id != UNKNOWN_NODE_ID)
|
||||||
{
|
{
|
||||||
elog(INFO, "node %i received notification to follow node %i",
|
if (primary_node_id == ELECTION_RERUN_NOTIFICATION)
|
||||||
shared_state->local_node_id,
|
{
|
||||||
primary_node_id);
|
elog(INFO, "node %i received notification to rerun promotion candidate election",
|
||||||
|
shared_state->local_node_id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
elog(INFO, "node %i received notification to follow node %i",
|
||||||
|
shared_state->local_node_id,
|
||||||
|
primary_node_id);
|
||||||
|
}
|
||||||
|
|
||||||
LWLockRelease(shared_state->lock);
|
LWLockRelease(shared_state->lock);
|
||||||
LWLockAcquire(shared_state->lock, LW_EXCLUSIVE);
|
LWLockAcquire(shared_state->lock, LW_EXCLUSIVE);
|
||||||
|
|||||||
@@ -2097,7 +2097,7 @@ do_primary_failover(void)
|
|||||||
}
|
}
|
||||||
else if (election_result == ELECTION_RERUN)
|
else if (election_result == ELECTION_RERUN)
|
||||||
{
|
{
|
||||||
log_notice(_("election rerun"));
|
log_notice(_("promotion candidate election will be rerun"));
|
||||||
/* notify siblings that they should rerun the election too */
|
/* notify siblings that they should rerun the election too */
|
||||||
notify_followers(&sibling_nodes, ELECTION_RERUN_NOTIFICATION);
|
notify_followers(&sibling_nodes, ELECTION_RERUN_NOTIFICATION);
|
||||||
|
|
||||||
@@ -2835,8 +2835,8 @@ notify_followers(NodeInfoList *standby_nodes, int follow_node_id)
|
|||||||
{
|
{
|
||||||
NodeInfoListCell *cell;
|
NodeInfoListCell *cell;
|
||||||
|
|
||||||
log_verbose(LOG_NOTICE, "%i followers to notify",
|
log_info(_("%i followers to notify"),
|
||||||
standby_nodes->node_count);
|
standby_nodes->node_count);
|
||||||
|
|
||||||
for (cell = standby_nodes->head; cell; cell = cell->next)
|
for (cell = standby_nodes->head; cell; cell = cell->next)
|
||||||
{
|
{
|
||||||
@@ -2855,8 +2855,19 @@ notify_followers(NodeInfoList *standby_nodes, int follow_node_id)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_verbose(LOG_NOTICE, "notifying node %i to follow node %i",
|
if (follow_node_id == ELECTION_RERUN_NOTIFICATION)
|
||||||
cell->node_info->node_id, follow_node_id);
|
{
|
||||||
|
log_notice(_("notifying node \"%s\" (node ID: %i) to rerun promotion candidate selection"),
|
||||||
|
cell->node_info->node_name,
|
||||||
|
cell->node_info->node_id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log_notice(_("notifying node \"%s\" (node ID: %i) to follow node %i"),
|
||||||
|
cell->node_info->node_name,
|
||||||
|
cell->node_info->node_id,
|
||||||
|
follow_node_id);
|
||||||
|
}
|
||||||
notify_follow_primary(cell->node_info->conn, follow_node_id);
|
notify_follow_primary(cell->node_info->conn, follow_node_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3887,9 +3898,6 @@ execute_failover_validation_command(t_node_info *node_info)
|
|||||||
|
|
||||||
termPQExpBuffer(&failover_validation_command);
|
termPQExpBuffer(&failover_validation_command);
|
||||||
|
|
||||||
if (return_value != 0)
|
|
||||||
log_warning(_("failover validation command returned %i"), return_value);
|
|
||||||
|
|
||||||
if (command_output.data[0] != '\0')
|
if (command_output.data[0] != '\0')
|
||||||
{
|
{
|
||||||
log_info("output returned by failover validation command:\n%s", command_output.data);
|
log_info("output returned by failover validation command:\n%s", command_output.data);
|
||||||
@@ -3904,7 +3912,8 @@ execute_failover_validation_command(t_node_info *node_info)
|
|||||||
if (return_value != 0)
|
if (return_value != 0)
|
||||||
{
|
{
|
||||||
/* create event here? */
|
/* create event here? */
|
||||||
log_notice(_("failover validation command returned a non-zero value (%i)"), return_value);
|
log_notice(_("failover validation command returned a non-zero value: %i"),
|
||||||
|
return_value);
|
||||||
return ELECTION_RERUN;
|
return ELECTION_RERUN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user