mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 00:26:30 +00:00
repmgrd: various fixed, mainly clearing status after a failover event
This commit is contained in:
33
dbutils.c
33
dbutils.c
@@ -1714,6 +1714,8 @@ clear_node_info_list(NodeInfoList *nodes)
|
||||
NodeInfoListCell *cell;
|
||||
NodeInfoListCell *next_cell;
|
||||
|
||||
log_debug("clear_node_info_list() - closing open connections");
|
||||
|
||||
/* close any open connections */
|
||||
for (cell = nodes->head; cell; cell = cell->next)
|
||||
{
|
||||
@@ -1724,6 +1726,8 @@ clear_node_info_list(NodeInfoList *nodes)
|
||||
}
|
||||
}
|
||||
|
||||
log_debug("clear_node_info_list() - unlinking");
|
||||
|
||||
cell = nodes->head;
|
||||
|
||||
while (cell != NULL)
|
||||
@@ -1733,7 +1737,8 @@ clear_node_info_list(NodeInfoList *nodes)
|
||||
pfree(cell);
|
||||
cell = next_cell;
|
||||
}
|
||||
|
||||
nodes->head = NULL;
|
||||
nodes->tail = NULL;
|
||||
nodes->node_count = 0;
|
||||
}
|
||||
|
||||
@@ -2493,6 +2498,32 @@ get_new_primary(PGconn *conn, int *primary_node_id)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
reset_voting_status(PGconn *conn)
|
||||
{
|
||||
PQExpBufferData query;
|
||||
PGresult *res;
|
||||
|
||||
initPQExpBuffer(&query);
|
||||
|
||||
appendPQExpBuffer(&query,
|
||||
"SELECT repmgr.reset_voting_status()");
|
||||
|
||||
res = PQexec(conn, query.data);
|
||||
termPQExpBuffer(&query);
|
||||
|
||||
// COMMAND_OK?
|
||||
if (!res || PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||
{
|
||||
log_error(_("unable to execute repmgr..reset_voting_status():\n %s"),
|
||||
PQerrorMessage(conn));
|
||||
}
|
||||
|
||||
PQclear(res);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* ============================ */
|
||||
/* replication status functions */
|
||||
/* ============================ */
|
||||
|
||||
Reference in New Issue
Block a user