mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
Remove option "--wal-keep-segments"
This is a remnant of the early repmgr days when there were no alternative mechanisms for ensuring sufficient WAL remains available while cloning a standby. The purpose of this setting was to override a check for an (arbitrary) minimum setting for "wal_keep_segments". As there's no reliable way of determining a sensible value for this, and improvements in pg_basebackup mean WALs can be streamed (possibly using a replication slot) while the backup is in progress, there's no point in keeping this around. We will however still emit a warning about setting "wal_keep_segments" if the configuration doesn't appear to provide any other way of ensuring WAL is available during/after the cloning process and "wal_keep_segments" is not set.
This commit is contained in:
@@ -87,10 +87,22 @@ static CheckStatus parse_node_check_archiver(const char *node_check_output, int
|
||||
static CheckStatus parse_node_check_replication_lag(const char *node_check_output, int *seconds, int *threshold);
|
||||
|
||||
/*
|
||||
* do_standby_clone()
|
||||
* STANDBY CLONE
|
||||
*
|
||||
* Event(s):
|
||||
* - standby_clone
|
||||
*
|
||||
* Parameters:
|
||||
* --upstream-conninfo
|
||||
* --no-upstream-connection
|
||||
* -F/--force
|
||||
* --dry-run
|
||||
* -c/--fast-checkpoint
|
||||
* --copy-external-config-files
|
||||
* --recovery-min-apply-delay
|
||||
* --replication-user XXX only required if no upstream record
|
||||
* --use-recovery-conninfo-password
|
||||
* --without-barman
|
||||
*/
|
||||
|
||||
void
|
||||
|
||||
@@ -22,7 +22,6 @@ typedef struct
|
||||
bool connection_param_provided;
|
||||
bool host_param_provided;
|
||||
bool limit_provided;
|
||||
bool wal_keep_segments_used;
|
||||
|
||||
/* general configuration options */
|
||||
char config_file[MAXPGPATH];
|
||||
@@ -68,7 +67,6 @@ typedef struct
|
||||
char upstream_conninfo[MAXLEN];
|
||||
int upstream_node_id;
|
||||
bool use_recovery_conninfo_password;
|
||||
char wal_keep_segments[MAXLEN];
|
||||
bool without_barman;
|
||||
|
||||
/* "standby register" options */
|
||||
@@ -111,7 +109,7 @@ typedef struct
|
||||
|
||||
#define T_RUNTIME_OPTIONS_INITIALIZER { \
|
||||
/* configuration metadata */ \
|
||||
false, false, false, false, false, \
|
||||
false, false, false, false, \
|
||||
/* general configuration options */ \
|
||||
"", false, false, "", false, \
|
||||
/* logging options */ \
|
||||
@@ -126,7 +124,7 @@ typedef struct
|
||||
UNKNOWN_NODE_ID, "", "", \
|
||||
/* "standby clone" options */ \
|
||||
false, CONFIG_FILE_SAMEPATH, false, false, false, "", "", "", \
|
||||
NO_UPSTREAM_NODE, false, "", false, \
|
||||
NO_UPSTREAM_NODE, false, false, \
|
||||
/* "standby register" options */ \
|
||||
false, 0, \
|
||||
/* "standby switchover" options */ \
|
||||
|
||||
@@ -334,15 +334,6 @@ main(int argc, char **argv)
|
||||
}
|
||||
break;
|
||||
|
||||
/* -w/--wal-keep-segments */
|
||||
case 'w':
|
||||
(void) repmgr_atoi(optarg, "-w/--wal-keep-segments", &cli_errors, false);
|
||||
strncpy(runtime_options.wal_keep_segments,
|
||||
optarg,
|
||||
MAXLEN);
|
||||
runtime_options.wal_keep_segments_used = true;
|
||||
break;
|
||||
|
||||
/* --no-upstream-connection */
|
||||
case OPT_NO_UPSTREAM_CONNECTION:
|
||||
runtime_options.no_upstream_connection = true;
|
||||
@@ -2160,23 +2151,13 @@ check_upstream_config(PGconn *conn, int server_version_num, bool exit_on_error)
|
||||
else if (mode != barman)
|
||||
{
|
||||
bool check_wal_keep_segments = false;
|
||||
char min_wal_keep_segments[MAXLEN] = "1";
|
||||
|
||||
/*
|
||||
* -w/--wal-keep-segments was supplied - check against that value
|
||||
*/
|
||||
if (runtime_options.wal_keep_segments_used == true)
|
||||
{
|
||||
check_wal_keep_segments = true;
|
||||
strncpy(min_wal_keep_segments, runtime_options.wal_keep_segments, MAXLEN);
|
||||
}
|
||||
|
||||
/*
|
||||
* A non-zero `wal_keep_segments` value will almost certainly be required
|
||||
* if pg_basebackup is being used with --xlog-method=fetch,
|
||||
* *and* no restore command has been specified
|
||||
*/
|
||||
else if (xlog_stream == false
|
||||
if (xlog_stream == false
|
||||
&& strcmp(config_file_options.restore_command, "") == 0)
|
||||
{
|
||||
check_wal_keep_segments = true;
|
||||
@@ -2184,14 +2165,13 @@ check_upstream_config(PGconn *conn, int server_version_num, bool exit_on_error)
|
||||
|
||||
if (check_wal_keep_segments == true)
|
||||
{
|
||||
i = guc_set_typed(conn, "wal_keep_segments", ">=", min_wal_keep_segments, "integer");
|
||||
i = guc_set_typed(conn, "wal_keep_segments", ">", "0", "integer");
|
||||
|
||||
if (i == 0 || i == -1)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
log_error(_("parameter \"wal_keep_segments\" on the upstream server must be be set to %s or greater"),
|
||||
min_wal_keep_segments);
|
||||
log_error(_("parameter \"wal_keep_segments\" on the upstream server must be be set to a non-zero value"));
|
||||
log_hint(_("Choose a value sufficiently high enough to retain enough WAL "
|
||||
"until the standby has been cloned and started.\n "
|
||||
"Alternatively set up WAL archiving using e.g. PgBarman and configure "
|
||||
|
||||
@@ -118,7 +118,6 @@ static struct option long_options[] =
|
||||
/* "standby clone" options */
|
||||
{"copy-external-config-files", optional_argument, NULL, OPT_COPY_EXTERNAL_CONFIG_FILES},
|
||||
{"fast-checkpoint", no_argument, NULL, 'c'},
|
||||
{"wal-keep-segments", required_argument, NULL, 'w'},
|
||||
{"no-upstream-connection", no_argument, NULL, OPT_NO_UPSTREAM_CONNECTION},
|
||||
{"recovery-min-apply-delay", required_argument, NULL, OPT_RECOVERY_MIN_APPLY_DELAY},
|
||||
{"replication-user", required_argument, NULL, OPT_REPLICATION_USER},
|
||||
|
||||
Reference in New Issue
Block a user