repmgrd: in BDR mode, have each repmgrd monitor each node

This will cover both the case when an entire node including
repmgrd goes down, and when one PostgreSQL instance goes down
but repmgrd is still up (in which case only one of the repmgrds
will handle the failover).
This commit is contained in:
Ian Barwick
2017-07-14 15:01:18 +09:00
parent e3b3fb65f0
commit 951c7dbd07
9 changed files with 211 additions and 89 deletions

View File

@@ -9,6 +9,7 @@
#include "access/xlogdefs.h"
#include "pqexpbuffer.h"
#include "portability/instr_time.h"
#include "config.h"
#include "strutil.h"
@@ -40,8 +41,10 @@ typedef enum {
RECORD_NOT_FOUND
} RecordStatus;
typedef enum {
MS_NORMAL = 0,
MS_DEGRADED = 1
} MonitoringState;
/*
* Struct to store node information
@@ -62,6 +65,7 @@ typedef struct s_node_info
bool is_ready;
bool is_visible;
XLogRecPtr last_wal_receive_lsn;
MonitoringState monitoring_state;
PGconn *conn;
} t_node_info;
@@ -80,6 +84,7 @@ typedef struct s_node_info
false, \
false, \
InvalidXLogRecPtr, \
MS_NORMAL, \
NULL \
}
@@ -323,5 +328,7 @@ void add_extension_tables_to_bdr_replication_set(PGconn *conn);
bool bdr_node_exists(PGconn *conn, const char *node_name);
bool am_bdr_failover_handler(PGconn *conn, int node_id);
void unset_bdr_failover_handler(PGconn *conn);
#endif /* dbutils.h */