Commit Graph

201 Commits

Author SHA1 Message Date
Ian Barwick
6e270b2faf repmgrd: catch cases where more than one node has initiated voting
The node(s) with higher ID will "yield", leaving the decision making
up to the node with the lower ID.

This happens very rarely, usually when the random delay is close
enough on two or mode nodes that vote initiation is simultaneous.
2017-07-18 17:04:24 +09:00
Ian Barwick
248525ccba Remove unused PQexpBuffer
It was being referenced without being initialised, but the output
which would have been placed there is not used anyway, so discard
completely.
2017-07-18 12:06:26 +09:00
Ian Barwick
2c8dd49831 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".
2017-07-17 16:47:42 +09:00
Ian Barwick
48a0aa3bf7 repmgrd: improve failover handling
Make retry frequency/interval configurable as per streaming replication.
2017-07-17 14:56:52 +09:00
Ian Barwick
a56bb41891 Remove redundant fields from node record struct 2017-07-17 14:11:14 +09:00
Ian Barwick
0dcd479322 Store node status in node record struct 2017-07-17 13:50:17 +09:00
Ian Barwick
46acf75286 Fix usage of get_primary_node_record() 2017-07-17 12:12:59 +09:00
Ian Barwick
437cb26b7e Fixes to function request_vote() 2017-07-17 12:04:56 +09:00
Ian Barwick
ec554e5694 Improve connection handling
Set "connect_timeout" and "fallback_application_name" if not present.
2017-07-17 11:10:37 +09:00
Ian Barwick
084e0429fc Disable non-BDR functions for BDR-only buils 2017-07-17 08:44:49 +09:00
Ian Barwick
ec00202a31 Add configure option --with-bdr-only
Builds repmgr with only BDR functionality; other code is disabled
at critical points.
2017-07-16 17:18:34 +09:00
Ian Barwick
a6f8d59f77 Initial support for BDR-only build 2017-07-16 17:18:23 +09:00
Ian Barwick
a29bc3e0fa Rename config.[ch] to configfile.[ch] 2017-07-16 09:41:26 +09:00
Ian Barwick
b1051bfca2 Minor fixes to BDR code 2017-07-16 08:27:07 +09:00
Ian Barwick
c93eb10ad3 Handle node recovery 2017-07-14 16:15:10 +09:00
Ian Barwick
951c7dbd07 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).
2017-07-14 15:01:18 +09:00
Ian Barwick
e3b3fb65f0 repmgrd: restrict BDR monitoring to two node setup
It's not safe to have more than two nodes with this kind of
"failover", so we don't need to select alternative nodes by
priority.
2017-07-14 12:56:11 +09:00
Ian Barwick
91c7013024 Remove erroneously added file 2017-07-14 11:25:37 +09:00
Ian Barwick
d653888c65 Support pre-10 WAL functions 2017-07-14 10:40:11 +09:00
Ian Barwick
dfcf85a62f repmgrd: further BDR sanity checks 2017-07-14 10:27:28 +09:00
Ian Barwick
875cdf5102 repmgrd: don't run in BDR mode on a node marked as inactive 2017-07-14 09:59:56 +09:00
Ian Barwick
aeba2e31f1 repmgrd: fix BDR sanity check 2017-07-14 09:54:34 +09:00
Ian Barwick
d77e8d4d22 repmgrd: split physical and BDR functionality into separate files 2017-07-13 17:21:29 +09:00
Ian Barwick
0320f409aa Detect BDR capability via presence of extension 2017-07-13 14:13:46 +09:00
Ian Barwick
2594a46a4f Limit repmgr installation on a BDR cluster to two nodes 2017-07-13 14:10:08 +09:00
Ian Barwick
7eadbf6b17 Various improvements to "repmgr bdr register/unregister" 2017-07-12 22:38:03 +09:00
Ian Barwick
0a1addfdc0 When registering a BDR node, sync repmgr.nodes from another node
If a BDR node is added via bdr_group_join(), repmgr.nodes will
start off empty, so we'll need to sync it ourselves before adding
it to the repmgr replication set.
2017-07-12 10:11:25 +09:00
Ian Barwick
1cccb1dd5a Add "repmgr bdr unregister" 2017-07-12 10:11:21 +09:00
Ian Barwick
71a0871232 Add "repmgr bdr register" 2017-07-11 15:38:58 +09:00
Ian Barwick
2962ffe605 repmgrd: initial BDR monitoring support 2017-07-10 23:58:59 +09:00
Ian Barwick
dddea9814b Add BDR-related database functions 2017-07-10 21:52:39 +09:00
Ian Barwick
941ed343f8 repmgrd: additional location check
If only one promotion candidate is available, check it is in the
same location as the primary.
2017-07-10 15:20:43 +09:00
Ian Barwick
5fbcf3e476 Remove witness server references 2017-07-10 09:31:31 +09:00
Ian Barwick
9e3d942917 Handle various (unlikely) failure states 2017-07-10 09:00:18 +09:00
Ian Barwick
5bf7098139 repmgrd: consolidate clear_node_info_list() calls 2017-07-09 11:10:49 +09:00
Ian Barwick
2787994a6e Make repmgrd failover settings configurable 2017-07-07 21:11:22 +09:00
Ian Barwick
b08511ec79 When cloning from Barman, use basebackups_directory
See: https://github.com/2ndQuadrant/repmgr/issues/312
2017-07-07 13:39:10 +09:00
Ian Barwick
35df85e67d repmgrd: improve handling of "degraded monitoring"
In some cases, the monitored upstream may not be available for a while
(e.g. network split), in which case it makes sense to have repmgrd
keep running and trying to reconnect. Previously it would just keel
over and quit.
2017-07-06 17:19:55 +09:00
Ian Barwick
6b82ecbafc repmgrd: check for visibility of primary location
Also support degraded monitoring status
2017-07-06 11:45:04 +09:00
Ian Barwick
0d226867b4 Add "location" column 2017-07-06 01:17:00 +09:00
Ian Barwick
9351e532b4 Ensure configuration parameter "replication_user" is smaller than NAMEDATALEN 2017-07-06 00:22:23 +09:00
Ian Barwick
ff4cc64a67 repmgrd: refresh upstream node record from upstream itself 2017-07-05 13:23:42 +09:00
Ian Barwick
3c45853b6f Fixes for cascaded standby failover 2017-07-05 12:43:35 +09:00
Ian Barwick
a31d66f826 repmgr standby follow: add event details
Useful to have a confirmation of which node was followed.
2017-07-05 11:36:30 +09:00
Ian Barwick
2f2a983272 Fixes for cascaded standby monitoring 2017-07-05 11:26:09 +09:00
Ian Barwick
614287548d Fix function get_primary_node_record() 2017-07-05 11:20:32 +09:00
Ian Barwick
617dee6bd6 Add function create_event_record()
For logging an event to the event table without generating an external
event notification.

Rename existing create_event_record*() functions to create_event_notification*()
as this describes their function better.
2017-07-05 09:52:22 +09:00
Ian Barwick
d3ec15cd25 Fixes from merge 2017-07-04 23:57:43 +09:00
Ian Barwick
582d0ef363 Rename "logxxx" configuration file parameters to "log_xxx"
This is more consistent with other parameters and conforms to
the pattern used by PostgreSQL itself, which uses the prefix "log_"
for logging parameters.

A warning will be emitted if the old version of the parameter name
is detected.
2017-07-04 23:36:47 +09:00
Ian Barwick
9bf264177f Add checks for use of --upstream-node-id 2017-07-04 23:35:19 +09:00