mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-25 16:16:29 +00:00
repmgrd: additional check to ensure only one node handles failover
It's possible the "failover" is completed by one repmgrd before the other has a chance to react, in which case the am_bdr_failover_handler() check will not apply. Instead check if the node record has already been set to "inactive".
This commit is contained in:
12
dbutils.c
12
dbutils.c
@@ -1395,7 +1395,7 @@ get_node_record_by_name(PGconn *conn, const char *node_name, t_node_info *node_i
|
||||
|
||||
if (record_status == RECORD_NOT_FOUND)
|
||||
{
|
||||
log_verbose(LOG_DEBUG, "get_node_record(): no record found for node %s",
|
||||
log_verbose(LOG_DEBUG, "get_node_record_by_name(): no record found for node %s",
|
||||
node_name);
|
||||
}
|
||||
|
||||
@@ -3250,10 +3250,18 @@ am_bdr_failover_handler(PGconn *conn, int node_id)
|
||||
"SELECT repmgr.am_bdr_failover_handler(%i)",
|
||||
node_id);
|
||||
|
||||
|
||||
res = PQexec(conn, query.data);
|
||||
termPQExpBuffer(&query);
|
||||
|
||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||
{
|
||||
log_error(_("unable to execute function repmgr.am_bdr_failover_handler():\n %s"),
|
||||
PQerrorMessage(conn));
|
||||
PQclear(res);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
am_handler = (strcmp(PQgetvalue(res, 0, 0), "t") == 0) ? true : false;
|
||||
|
||||
PQclear(res);
|
||||
|
||||
Reference in New Issue
Block a user