57 Commits

Author SHA1 Message Date
Ian Barwick
71e23107e7 Add upgrade route for repmgr 3.x to repmgr 5.1
The removal of some extensions functions means it's not possible to
follow the conventional incremental upgrade path; instead we'll
create a script for direct upgrades to 5.1.
2020-04-09 16:08:35 +09:00
Ian Barwick
4d4ed3bcd6 Remove BDR 2.x support
The BDR 2.x support was conceptual only and was never used in
production. As BDR 2.x will be EOL'd shortly, there is no risk it will
be needed.
2020-01-16 09:52:42 +09:00
Ian Barwick
5d81e03d2d Bump master branch to 5.1dev 2019-10-16 11:04:37 +09:00
Ian Barwick
37bfe6ee4f Have "make clean" remove "repmgr_version.h" 2019-08-29 17:17:33 +09:00
Ian Barwick
931da14df1 Rename some "repmgr daemon ..." commands to "repmgr service ..."
"repmgr daemon" can be interpreted to mean the commands affect the local
daemon process only. Rename the commands which affect the entire cluster
to "repmgr service ...".

The "repmgr daemon ..." form of the affected commands is retained for backwards
 compatibility.
2019-08-28 14:58:11 +09:00
Ian Barwick
fb6352735a The next major release will be 5.0.
4.5 was a placeholder release number in case a major release was required
prior to the release of Pg12.
2019-08-22 15:15:56 +09:00
Ian Barwick
8d55cab25e Convert configuration file parsing to use flex
Previously, repmgr was using a very simple ad-hoc string-based parser,
which had various limitations and allowed configuration files to be
created in a way which could cause confusion and/or unexpected
behaviour.

For example, it accepted strings enclosed in single quotes, but treated
strings enclosed in double quotes literally. A node_name defined thusly:

    node_name="somenode"

would result in the literal value '"somenode"' being used, which could
lead to unobvious errors along the lines of:

    no record found for ""somenode""

The configuration file parser has been adapted from the one used by
PostgreSQL itself, so behaves more-or-less identically (though some
functions such as file inclusion are not supported in repmgr).

This makes configuration parsing more robust and consistent;
additionally, error reporting will be more precise.

Note this does mean that some repmgr.conf items previously accepted
as valid by repmgr will now be rejected; in particular this includes
strings containing spaces which are not enclosed in single quotes.
2019-08-01 10:17:20 +09:00
Ian Barwick
ab7e527af8 More sed tweakage 2019-07-26 21:25:16 +09:00
Ian Barwick
9274fdc6ba Use more portable sed invocation
Works on FreeBSD too.
2019-07-26 20:13:15 +09:00
Ian Barwick
018394faa2 Define PG_ACTUAL_VERSION_NUM
Due to [insert reason here], in the Debian package build process (and
only there), when building frontend code PG_VERSION_NUM appears to be
from the newest libpq-dev version installed, and does not necessarily
match the version of the server the code is being built against.

To work around this distribution-specific package build issue, we'll
define our own substitution variable which is taken from the value
provided in Makefile.global.
2019-07-26 18:12:07 +09:00
Ian Barwick
532a5207e2 More portable usage of sed in Makefile 2019-07-26 18:08:16 +09:00
Ian Barwick
5bf9605286 Revert "Convert configuration file parsing to use flex"
This reverts commit c6ca183247.

Backing out this patch for now as the Debian build system doesn't
seem to like it, even though it builds just fine on Debian itself.
2019-07-18 10:19:18 +09:00
Ian Barwick
c6ca183247 Convert configuration file parsing to use flex
Previously, repmgr was using a very simple ad-hoc string-based parser,
which had various limitations and allowed configuration files to be
created in a way which could cause confusion and/or unexpected
behaviour.

For example, it accepted strings enclosed in single quotes, but treated
strings enclosed in double quotes literally. A node_name defined thusly:

    node_name="somenode"

would result in the literal value '"somenode"' being used, which could
lead to unobvious errors along the lines of:

    no record found for ""somenode""

The configuration file parser has been adapted from the one used by
PostgreSQL itself, so behaves more-or-less identically (though some
functions such as file inclusion are not supported in repmgr).

This makes configuration parsing more robust and consistent;
additionally, error reporting will be more precise.

Note this does mean that some repmgr.conf items previously accepted
as valid by repmgr will now be rejected; in particular this includes
strings containing spaces which are not enclosed in single quotes.
2019-07-03 12:18:01 +09:00
Ian Barwick
aa44c8abf1 Add .sql extension files for 4.5 2019-06-04 15:58:22 +09:00
Ian Barwick
456a95f159 Bump master branch to 4.5dev
Note that the next release is intended to be 5.0 to coincide with the
release of PostgreSQL 12; 4.5 is currently a placeholder in case we
need to push out a feature release before then.
2019-06-04 14:26:48 +09:00
Ian Barwick
14b805d650 Makefile: improve documentation targets
- add documentation targets to main Makefile
- ensure clean/maintainer-clean remove all generated documentation files
2019-05-24 14:15:54 +09:00
Ian Barwick
409eb47e2a doc: convert documentation to DocBook XML
This brings the repmgr documentation build system in line with that
used by the main PostgreSQL project, and removed the restriction
that documentation must be built against PostgreSQL 9.6 or earlier.

Main formatting changes are:

 - convert empty-element tags (mainly <xref/>)
 - put <indexterm> sections in the correct location
 - correct usage of various entities.
2019-05-09 16:24:21 +09:00
Ian Barwick
aef8e31897 Bump master branch to 4.4dev 2019-03-28 17:24:36 +09:00
John Naylor
4f9fc56871 Fix assorted Makefile bugs
1. The target additional-maintainer-clean was misspelled as
maintainer-additional-clean.

2. Add add missing clean targets, in particular sysutils.o, config.h,
repmgr_version.h, and Makefile.global. While at it, use a wildcard
for obj files.

3. Don't delete configure.

4. Remove generated file doc/version.sgml from the repo.

5. Have maintainer-clean recurse to the doc directory.
2019-03-15 16:29:31 +09:00
Ian Barwick
b1875a8d91 Split command execution functions into separate library
These may need to be executed by repmgrd.
2019-02-27 14:41:17 +09:00
Ian Barwick
5f1bf0fb8f Bump master branch to 4.3dev 2018-11-16 12:50:04 +09:00
Ian Barwick
56173d94a9 Fix Makefile for VPATH builds under PostgreSQL 11 2018-10-22 16:38:18 +09:00
Ian Barwick
2491b8ae52 Add functionality to "pause" repmgrd
In some circumstances, e.g. while performing a switchover, it is essential
that repmgrd does not take any kind of failover action, as this will put
the cluster into an incorrect state.

Previously it was necessary to stop repmgrd on all nodes (or at least
those nodes which repmgrd would consider as promotion candidates), however
this is a cumbersome and potentially risk-prone operation, particularly if the
replication cluster contains more than a couple of servers.

To prevent this issue from occurring, this patch introduces the ability
to "pause" repmgrd on all nodes wth a single command ("repmgr daemon pause")
which notifies repmgrd not to take any failover action until the node
is "unpaused" ("repmgr daemon unpause").

"repmgr daemon status" provides an overview of each node and whether repmgrd
is running, and if so whether it is paused.

"repmgr standby switchover" has been modified to automatically pause repmgrd
while carrying out the switchover.

See documentation for further details.
2018-09-27 16:42:10 +09:00
Ian Barwick
08ab6290c1 Add dummy 4.2 extension SQL file 2018-08-14 09:54:27 +09:00
Ian Barwick
c236405251 Update extension metadata for 4.1 release
This release does not make any changes to the extension database
objects.
2018-07-24 09:56:43 +09:00
Ian Barwick
b8b991398a Escape double-quotes in strings passed to an event notification script
The string in question will be generated internally by repmgr as a simple
one-line string with no control characters etc., so all that needs to be
escaped at the moment are any double quotes.
2017-11-16 10:36:48 +09:00
Ian Barwick
7fffe3ed96 witness: initial code framework 2017-11-15 13:47:41 +09:00
Ian Barwick
d8c2f66c5b Initial SGML documentation support 2017-10-05 10:29:24 +09:00
Marco Nenciarini
dd9352a777 Fix executables installation in PostgreSQL 9.3 2017-10-04 09:36:20 +09:00
Ian Barwick
3bc38631cf Update Makefile 2017-10-04 09:36:16 +09:00
Ian Barwick
8f031d3c20 Add "includedir_internal" to "PG_CPPFLAGS" 2017-09-19 22:19:04 +09:00
Ian Barwick
34fb09cae4 Add placeholder test 2017-09-18 21:55:23 +09:00
Ian Barwick
5a3c26a0b8 Makefile: better fix for SCRIPTS_built and 9.4 2017-09-17 07:42:58 +09:00
Ian Barwick
621ca352df Dynamically generate "repmgr_version.h" 2017-09-12 12:02:26 +09:00
Ian Barwick
72e037d55b SCRIPTS_built also required for 9.4 2017-09-02 12:03:17 +09:00
Ian Barwick
4ba3e67e11 Hacky workaround for hacky workaround in 9.4
For some reason 9.4 doesn't install the repmgr/repmgrd binaries
with "SCRIPTS_built". "SCRIPTS" seems to work for both 9.4 and
later versions.
2017-09-02 11:54:07 +09:00
Ian Barwick
5e019a65e7 Initial upgrade SQL for repmgr3 to repmgr4 2017-08-17 21:14:55 +09:00
Ian Barwick
5948cf6cda repmgr standby switchover: add sanity check for pg_rewind useability
pg_rewind will only be executed on a demoted primary if explictly
requested, to prevent transactions on the primary, which
were never replicated, from being automatically overwritten.

If --force-rewind is provided, we'll need to check pg_rewind
is actually useable before we need to use it.
2017-08-04 00:45:55 +09:00
Ian Barwick
fbe74cbee4 Rename repmgr{d}4 binaries to repmgr{d}
This was useful during initial development but now no longer required.
2017-07-31 10:37:15 +09:00
Ian Barwick
8a2e4db1bc Add "repmgr node status"
Outputs an overview of a node's status, and emits warnings if any
issues detected.
2017-07-25 00:39:04 +09:00
Ian Barwick
a29bc3e0fa Rename config.[ch] to configfile.[ch] 2017-07-16 09:41:26 +09:00
Ian Barwick
d77e8d4d22 repmgrd: split physical and BDR functionality into separate files 2017-07-13 17:21:29 +09:00
Ian Barwick
71a0871232 Add "repmgr bdr register" 2017-07-11 15:38:58 +09:00
Ian Barwick
46c956e61a Use "primary" instead of "master" 2017-06-23 21:33:54 +09:00
Ian Barwick
bfa6f6709d repmgrd: add --help output and update Makefile 2017-06-12 09:11:32 +09:00
Ian Barwick
4c5f065ef2 Check data directory not used by an active instance before cloning
This involves adding some infrastructure to parse pg_control in a
reasonably version-independent fashion. This will probably be useful
in other contexts where we need to verify the status of a
data directory where the instance isn't running.
2017-05-12 08:46:49 +09:00
Ian Barwick
611e3b5e29 Further "standby clone" code 2017-05-01 23:34:01 +09:00
Ian Barwick
dc347f1484 Additional "standby clone" code
We'll break up the unwieldy "do_standby_clone()" function into discrete
unit for easier maintenance.
2017-04-28 22:00:26 +09:00
Ian Barwick
99e7bb0ea3 Initial code for standby clone 2017-04-27 09:22:09 +09:00
Ian Barwick
bcf55b4f72 Split "action" functions to individual files
repmgr3's repmgr.c file was not far off 10,000 lines - this will make
it easier to manage individual parts of the code.
2017-04-26 22:58:21 +09:00