Commit Graph

1047 Commits

Author SHA1 Message Date
Ian Barwick
40410e43ab doc: update FAQ
Make it clear 3.x is no longer maintained.
2019-01-07 12:34:43 +09:00
Ian Barwick
3c25d5a03a doc: update FAQ
Add link to repmgr compatibility matrix.
2019-01-07 12:22:52 +09:00
Ian Barwick
7e21ceb158 doc: note importance of installing same repmgr versions 2019-01-07 12:18:17 +09:00
Ian Barwick
313aa3c5d7 Refactor follow verification to reduce need for CHECKPOINT
A CHECKPOINT is not always required; hopefully we can narrow it down
to one corner case where we need to determine the minium recovery
location.

Also get local timeline ID via IDENTIFY_SYSTEM, as fetching it from
pg_control risks returning the prior timeline ID if the timeline
switch has just taken place and no restart point has yet occurred.
2018-12-04 15:27:22 +09:00
Ian Barwick
10d46f7e85 Fix variable name typo 2018-12-04 10:22:23 +09:00
Ian Barwick
9e90fcd584 "standby follow": verify status of follow target
This commit adds infrastruture for repmgr to be able to check
whether one standby can attach to another node, regardless whether
it is a standby or a primary.

This is intended to prevent a node from attempting to follow a
node whose timeline has diverged. The --dry-run option makes
it possible to test a follow operation before it is carried out.

As a useful side-effect this makes it possible for a standby to
follow another standby.

This is an initial implementation; documentation and possibly
further changes to follow.
2018-11-29 17:14:38 +09:00
Ian Barwick
c53782cda3 Fix typo in query 2018-11-29 15:24:49 +09:00
Ian Barwick
66b40ffc68 Simplify function create_replication_slot()
Following the changes in 793d83b, it's no longer necessary to
pass the server version number.
2018-11-29 14:35:01 +09:00
Ian Barwick
a6a2be2239 Teach witness repmgrd to deal with the absence of a primary
Previously it would refuse to start if the primary was not reachable,
the thinking being that it's pointless trying to monitor an incomplete
cluster.

However following an aborted failover situation, repmgrd will restart
monitoring and on the witness server, this will lead to it aborting
itself due to to continuing absence of primary.

To resolve this, witness repmgrd will now start monitoring in degraded
mode if no primary is found in the hope a primary will reappear at
some point.
2018-11-29 12:15:41 +09:00
Ian Barwick
bdcc4d9e83 Check correct result status in ...primary_last_seen() functions 2018-11-29 11:08:28 +09:00
Ian Barwick
9f587efb74 doc: update HISTORY 2018-11-29 10:34:28 +09:00
Ian Barwick
2aacd29e60 "witness register": don't try and read nodes table if it doesn't exist
Previously, "repmgr witness register --dry-run" would attempt to check
for records in the nodes table, but that might not exist yet. Skip
that check if the repmgr extension is not yet installed.

Implements GitHub #513.
2018-11-28 15:06:20 +09:00
Ian Barwick
311f7e561e "standby switchover": use empheral witness server connection
Intended to prevent issue reported in GitHub #514.
2018-11-28 14:29:41 +09:00
Ian Barwick
b498db87aa Remove redundant function declaration 2018-11-28 13:51:14 +09:00
Ian Barwick
74c44a7178 doc: document "repmgr node service"
This was originally intended for internal use, but it's mentioned
several times in the documentation and is useful for diagnostic
purposes.
2018-11-28 12:58:07 +09:00
Ian Barwick
5ff3744895 Create function get_pg_version() to read PG_VERSION
With the recovery configuration changes in PostgreSQL 12, there will
be situations where we'll need to determine the version number from
a dormant data directory in order to determine whether to write
recovery.conf or not.
2018-11-27 09:39:56 +09:00
Ian Barwick
793d83b22c Refactor server version detection
Most of the time we can simply get the version number directly from
the connection handle. Previously it was held in a global variable,
which was an icky way of doing things.

In a few special cases we also need the actual version string, which
is obtained directly from the database.
2018-11-22 21:30:31 +09:00
Ian Barwick
0f4e04e61e Add function get_current_lsn()
This is a somewhat convoluted attempt to retrieve the current LSN
of any node, regardless of whether in recovery or not, and if in
recovery, independent of whether streaming or recovering from
archive.
2018-11-22 19:31:49 +09:00
Ian Barwick
80a280cbf4 Add function get_timeline_history()
This will be required for verifying whether one node is able to
follow another node.
2018-11-22 15:26:50 +09:00
Ian Barwick
b223cb4cee standby follow: improve handling of --upstream-node-id 2018-11-22 11:16:44 +09:00
Ian Barwick
9d1f5c0de3 Update 4.2 - 4.3 extension upgrade script 2018-11-21 12:39:27 +09:00
Ian Barwick
784c9c4793 repmgrd: return predictable default values for get_primary_last_seen()
Return 0 if the node is not in recovery. In which case it's probably
rather pointless calling this function anyway.

Return -1 if the "last_seen" field has never been set (i.e. repmgrd
hasn't started yet).
2018-11-21 11:30:32 +09:00
Ian Barwick
0caec90d81 repmgrd: set primary last seen 2018-11-21 11:30:27 +09:00
Ian Barwick
1458f6e6aa add functions to determine when primary last seen by repmgrd node 2018-11-21 11:30:22 +09:00
Ian Barwick
a2d38c6084 doc: clarify "repmgr standby clone --recovery-conf-only" option
Make it clearer that the standby needs to have been cloned by whatever
method before running the command.
2018-11-20 10:19:53 +09:00
Ian Barwick
5f1bf0fb8f Bump master branch to 4.3dev 2018-11-16 12:50:04 +09:00
Ian Barwick
7d99b96717 Update/correct comments in controldata code 2018-11-14 09:52:52 +09:00
Ian Barwick
3b10750a7f doc: fix missing quotation marks
Patch from Cédric Villemain
2018-11-12 10:22:07 +09:00
Ian Barwick
af0a60b8eb doc: remove redundant warning
No longer relevant for 4.2 and later.
2018-11-12 09:38:11 +09:00
Ian Barwick
b419c5fec7 doc: update FAQ
Emphasize that repmgr does not actually perform replication.
2018-11-05 10:06:43 +09:00
Ian Barwick
2cfcc33a64 doc: add version compatibility matrix 2018-11-05 09:54:13 +09:00
Ian Barwick
273db444b2 doc: clarify replication slot FAQ entry 2018-10-31 16:20:15 +09:00
Ian Barwick
2bf3eeb931 doc: update FAQ
Emphasize that repmgr does not actually perform replication.
2018-10-31 11:56:41 +09:00
Ian Barwick
c3bc5585d9 Add sanity check for extension version
This should cover the cases where the "repmgr" extension was installed
manually but not updated, or an upgrade was not fully completed.
2018-10-31 11:16:36 +09:00
Ian Barwick
b84f217710 doc: note repmgr extension can be installed manually 2018-10-31 10:27:37 +09:00
Ian Barwick
90c49c0c28 doc: consolidate descriptions of SSH connectivity requirements 2018-10-31 10:14:03 +09:00
Ian Barwick
41c1550788 doc: clarify network and software prerequisites 2018-10-31 10:01:18 +09:00
Ian Barwick
c336e384ab Support "pg_promote()" function (PostgreSQL 12 and later)
This is an experimental feature.
2018-10-26 11:02:45 +09:00
Ian Barwick
bc1956dee9 Formatting standardization 2018-10-26 10:42:13 +09:00
Ian Barwick
a459c60145 Avoid defining variable-length arrays
As of PostgreSQL commit d9dd406f, variable length arrays are no longer
permitted. As they're not actually required anyway, just define appropriate
constants.

Also noted in GitHub #510.
2018-10-26 10:09:45 +09:00
Ian Barwick
65721bbbcd doc: update README 2018-10-24 15:24:04 +09:00
Ian Barwick
96895ba8a8 doc: update 4.2 release notes 2018-10-24 15:24:00 +09:00
Ian Barwick
e0d6d906e7 repmgrd: fix upstream role check
Only take action if it's confirmed as a standby.
2018-10-23 12:47:55 +09:00
Ian Barwick
dc8ffd30c6 "standby switchover": close all connections used to check repmgrd status
The connections used to check repmgrd status on all nodes were not being
closed if repmgrd was not running. Normally this wouldn't be a huge
problem as they will go away when repmgr terminates or the PostgreSQL
server restarted. However, if shutdown mode is "smart", the open
connection on the demotion candidate will cause the shutdown operation
to fail until repmgr times out.
2018-10-23 11:05:28 +09:00
Ian Barwick
24392fa11b doc: fix typos 2018-10-23 09:21:00 +09:00
Ian Barwick
06b5239ada doc: fix typo
Per user report on mailing list.
2018-10-23 08:59:30 +09:00
Ian Barwick
56173d94a9 Fix Makefile for VPATH builds under PostgreSQL 11 2018-10-22 16:38:18 +09:00
Ian Barwick
578f11003c repmgrd: improve node role change detection 2018-10-19 11:25:11 +09:00
Ian Barwick
36bd7cdc9f Speed up witness "failover" during a switchover 2018-10-18 17:26:29 +09:00
Ian Barwick
62ac56c3f5 repmgrd: handle case where upstream is no longer primary
If the upstream comes back on line (e.g. after a switchover), and its
status is no longer primary, restart monitoring to ensure the correct
primary (potentially the current node) is being monitored.
2018-10-18 16:50:13 +09:00