mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-23 23:26:30 +00:00
Improve "archive_mode" configuration check
There's no compelling reason to require "archive_mode" to be enabled for streaming replication. It is of course a good idea to archive WAL using e.g. barman ( http://www.pgbarman.org/ ) as part of a comprehensive backup strategy, but repmgr and streaming replication work fine without it. Per GitHub #141. Also revise the configuration check for "archive_command" to be triggered only when "archive_mode" is not "off", as from PostgreSQL 9.5 onwards "archive_mode" can also be "on" or "always".
This commit is contained in:
35
repmgr.c
35
repmgr.c
@@ -4314,31 +4314,18 @@ check_upstream_config(PGconn *conn, int server_version_num, bool exit_on_error)
|
||||
}
|
||||
}
|
||||
|
||||
i = guc_set(conn, "archive_mode", "=", "on");
|
||||
if (i == 0 || i == -1)
|
||||
{
|
||||
if (i == 0)
|
||||
log_err(_("parameter 'archive_mode' must be set to 'on'\n"));
|
||||
|
||||
if (exit_on_error == true)
|
||||
{
|
||||
PQfinish(conn);
|
||||
exit(ERR_BAD_CONFIG);
|
||||
}
|
||||
|
||||
config_ok = false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* check that 'archive_command' is non empty (however it's not practical to
|
||||
* check that it's actually valid)
|
||||
* If archive_mode is enabled, check that 'archive_command' is non empty
|
||||
* (however it's not practical to check that it actually represents a valid
|
||||
* command).
|
||||
*
|
||||
* if 'archive_mode' is not on, pg_settings returns '(disabled)' regardless
|
||||
* of what's in 'archive_command', so until 'archive_mode' is on we can't
|
||||
* properly check it.
|
||||
* From PostgreSQL 9.5, archive_mode can be one of 'off', 'on' or 'always'
|
||||
* so for ease of backwards compatibility, rather than explicitly check for an
|
||||
* enabled mode, check that it's not "off".
|
||||
*/
|
||||
if (guc_set(conn, "archive_mode", "=", "on"))
|
||||
|
||||
if (guc_set(conn, "archive_mode", "!=", "off"))
|
||||
{
|
||||
i = guc_set(conn, "archive_command", "!=", "");
|
||||
|
||||
@@ -4360,9 +4347,11 @@ check_upstream_config(PGconn *conn, int server_version_num, bool exit_on_error)
|
||||
|
||||
/*
|
||||
* Check that 'hot_standby' is on. This isn't strictly necessary
|
||||
* for the primary server, however the assumption is that configuration
|
||||
* should be consistent for all servers in a cluster.
|
||||
* for the primary server, however the assumption is that we'll be
|
||||
* cloning standbys and thus copying the primary configuration;
|
||||
* this way the standby will be correctly configured by default.
|
||||
*/
|
||||
|
||||
i = guc_set(conn, "hot_standby", "=", "on");
|
||||
if (i == 0 || i == -1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user