mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-23 15:16:29 +00:00
minor fixes
This commit is contained in:
11
repmgr.c
11
repmgr.c
@@ -170,7 +170,8 @@ request_vote(PG_FUNCTION_ARGS)
|
||||
// keep lock until end of function?
|
||||
|
||||
/* this node has initiated voting or already responded to another node */
|
||||
if (shared_state->voting_status != VS_NO_VOTE)
|
||||
if (current_electoral_term == shared_state->current_electoral_term
|
||||
&& shared_state->voting_status != VS_NO_VOTE)
|
||||
{
|
||||
LWLockRelease(shared_state->lock);
|
||||
|
||||
@@ -178,7 +179,9 @@ request_vote(PG_FUNCTION_ARGS)
|
||||
}
|
||||
|
||||
|
||||
elog(INFO, "requesting node id is %i", requesting_node_id);
|
||||
elog(INFO, "requesting node id is %i for electoral term %i (our term: %i)",
|
||||
requesting_node_id, current_electoral_term,
|
||||
shared_state->current_electoral_term);
|
||||
|
||||
SPI_connect();
|
||||
|
||||
@@ -205,7 +208,7 @@ request_vote(PG_FUNCTION_ARGS)
|
||||
|
||||
/* indicate this node has responded to a vote request */
|
||||
shared_state->voting_status = VS_VOTE_REQUEST_RECEIVED;
|
||||
shared_state->current_electoral_term += 1;
|
||||
shared_state->current_electoral_term = current_electoral_term;
|
||||
|
||||
LWLockRelease(shared_state->lock);
|
||||
|
||||
@@ -240,6 +243,8 @@ set_voting_status_initiated(PG_FUNCTION_ARGS)
|
||||
electoral_term = shared_state->current_electoral_term;
|
||||
LWLockRelease(shared_state->lock);
|
||||
|
||||
elog(INFO, "setting voting term to %i", electoral_term);
|
||||
|
||||
PG_RETURN_INT32(electoral_term);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user