mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
Remove redundant fields from node record struct
This commit is contained in:
@@ -1299,10 +1299,10 @@ _populate_node_record(PGresult *res, t_node_info *node_info, int row)
|
||||
node_info->active = atobool(PQgetvalue(res, row, 9));
|
||||
|
||||
/* Set remaining struct fields with default values */
|
||||
node_info->is_ready = false;
|
||||
node_info->is_visible = false;
|
||||
node_info->node_status = NODE_STATUS_UNKNOWN;
|
||||
node_info->last_wal_receive_lsn = InvalidXLogRecPtr;
|
||||
node_info->monitoring_state = MS_NORMAL;
|
||||
node_info->conn = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -68,8 +68,6 @@ typedef struct s_node_info
|
||||
bool active;
|
||||
char slot_name[MAXLEN];
|
||||
/* used during failover to track node status */
|
||||
bool is_ready;
|
||||
bool is_visible;
|
||||
XLogRecPtr last_wal_receive_lsn;
|
||||
NodeStatus node_status;
|
||||
MonitoringState monitoring_state;
|
||||
@@ -88,8 +86,6 @@ typedef struct s_node_info
|
||||
DEFAULT_PRIORITY, \
|
||||
true, \
|
||||
"", \
|
||||
false, \
|
||||
false, \
|
||||
InvalidXLogRecPtr, \
|
||||
NODE_STATUS_UNKNOWN, \
|
||||
MS_NORMAL, \
|
||||
|
||||
@@ -145,8 +145,6 @@ monitor_streaming_primary(void)
|
||||
instr_time log_status_interval_start;
|
||||
PQExpBufferData event_details;
|
||||
|
||||
local_node_info.node_status = NODE_STATUS_UP;
|
||||
|
||||
reset_node_voting_status();
|
||||
|
||||
/* Log startup event */
|
||||
@@ -174,6 +172,7 @@ monitor_streaming_primary(void)
|
||||
}
|
||||
|
||||
INSTR_TIME_SET_CURRENT(log_status_interval_start);
|
||||
local_node_info.node_status = NODE_STATUS_UP;
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -349,7 +348,6 @@ monitor_streaming_standby(void)
|
||||
instr_time log_status_interval_start;
|
||||
PQExpBufferData event_details;
|
||||
|
||||
upstream_node_info.node_status = NODE_STATUS_UP;
|
||||
reset_node_voting_status();
|
||||
|
||||
log_debug("monitor_streaming_standby()");
|
||||
@@ -466,6 +464,7 @@ monitor_streaming_standby(void)
|
||||
|
||||
monitoring_state = MS_NORMAL;
|
||||
INSTR_TIME_SET_CURRENT(log_status_interval_start);
|
||||
upstream_node_info.node_status = NODE_STATUS_UP;
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -1572,7 +1571,7 @@ do_election(void)
|
||||
for (cell = standby_nodes.head; cell; cell = cell->next)
|
||||
{
|
||||
/* assume the worst case */
|
||||
cell->node_info->is_visible = false;
|
||||
cell->node_info->node_status = NODE_STATUS_UNKNOWN;
|
||||
|
||||
cell->node_info->conn = establish_db_connection(cell->node_info->conninfo, false);
|
||||
|
||||
@@ -1614,7 +1613,7 @@ do_election(void)
|
||||
}
|
||||
}
|
||||
|
||||
cell->node_info->is_visible = true;
|
||||
cell->node_info->node_status = NODE_STATUS_UP;
|
||||
visible_nodes ++;
|
||||
}
|
||||
|
||||
@@ -1655,8 +1654,9 @@ do_election(void)
|
||||
{
|
||||
log_debug("checking node %i...", cell->node_info->node_id);
|
||||
/* ignore unreachable nodes */
|
||||
if (cell->node_info->is_visible == false)
|
||||
if (cell->node_info->node_status != NODE_STATUS_UP)
|
||||
continue;
|
||||
|
||||
votes_for_me += request_vote(cell->node_info->conn,
|
||||
&local_node_info,
|
||||
cell->node_info,
|
||||
|
||||
Reference in New Issue
Block a user