repmgrd: during failover, check if a node was already promoted

Previously, repmgrd assumed that during a failover, there would not
already be another primary node. However it's possible a node was
promoted manually. While this is not a desirable situation, it's
conceivable this could happen in the wild, so we should check for
it and react accordingly.

Also sanity-check that the follow target can actually be followed.

Addresses issue raised in GitHub #420.
This commit is contained in:
Ian Barwick
2019-03-21 16:16:59 +09:00
parent 6f0f338968
commit 539861cb58
4 changed files with 290 additions and 17 deletions

View File

@@ -302,6 +302,7 @@ typedef struct BdrNodeInfoList
typedef struct
{
char current_timestamp[MAXLEN];
bool in_recovery;
XLogRecPtr last_wal_receive_lsn;
XLogRecPtr last_wal_replay_lsn;
char last_xact_replay_timestamp[MAXLEN];