diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2016-02-29 20:01:54 -0500 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2016-03-18 23:56:03 +0100 |
commit | b555ed8102672cfedb06559952b8341756386d69 (patch) | |
tree | 6e3174c6e0bcd2faee09307092ecdca5dd0169b9 /src | |
parent | 4e1d2a170836028370675922ea9a690648d3c18d (diff) | |
download | postgresql-b555ed8102672cfedb06559952b8341756386d69.tar.gz postgresql-b555ed8102672cfedb06559952b8341756386d69.zip |
Merge wal_level "archive" and "hot_standby" into new name "replica"
The distinction between "archive" and "hot_standby" existed only because
at the time "hot_standby" was added, there was some uncertainty about
stability. This is now a long time ago. We would like to move forward
with simplifying the replication configuration, but this distinction is
in the way, because a primary server cannot tell (without asking a
standby or predicting the future) which one of these would be the
appropriate level.
Pick a new name for the combined setting to make it clearer that it
covers all (non-logical) backup and replication uses. The old values
are still accepted but are converted internally.
Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
Reviewed-by: David Steele <david@pgmasters.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/access/rmgrdesc/xlogdesc.c | 5 | ||||
-rw-r--r-- | src/backend/access/transam/xact.c | 2 | ||||
-rw-r--r-- | src/backend/access/transam/xlog.c | 20 | ||||
-rw-r--r-- | src/backend/access/transam/xlogfuncs.c | 2 | ||||
-rw-r--r-- | src/backend/postmaster/postmaster.c | 2 | ||||
-rw-r--r-- | src/backend/replication/slot.c | 2 | ||||
-rw-r--r-- | src/backend/utils/misc/postgresql.conf.sample | 2 | ||||
-rw-r--r-- | src/bin/pg_basebackup/t/010_pg_basebackup.pl | 2 | ||||
-rw-r--r-- | src/bin/pg_controldata/pg_controldata.c | 6 | ||||
-rw-r--r-- | src/include/access/xlog.h | 11 | ||||
-rw-r--r-- | src/include/catalog/pg_control.h | 2 | ||||
-rw-r--r-- | src/test/perl/PostgresNode.pm | 2 |
12 files changed, 27 insertions, 31 deletions
diff --git a/src/backend/access/rmgrdesc/xlogdesc.c b/src/backend/access/rmgrdesc/xlogdesc.c index 2dcbfbda372..022bd44eff2 100644 --- a/src/backend/access/rmgrdesc/xlogdesc.c +++ b/src/backend/access/rmgrdesc/xlogdesc.c @@ -25,8 +25,9 @@ */ const struct config_enum_entry wal_level_options[] = { {"minimal", WAL_LEVEL_MINIMAL, false}, - {"archive", WAL_LEVEL_ARCHIVE, false}, - {"hot_standby", WAL_LEVEL_HOT_STANDBY, false}, + {"replica", WAL_LEVEL_REPLICA, false}, + {"archive", WAL_LEVEL_REPLICA, true}, /* deprecated */ + {"hot_standby", WAL_LEVEL_REPLICA, true}, /* deprecated */ {"logical", WAL_LEVEL_LOGICAL, false}, {NULL, 0, false} }; diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 8a2cd452056..89a14b4cbe4 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -1254,7 +1254,7 @@ RecordTransactionCommit(void) * this case, but we don't currently try to do that. It would certainly * cause problems at least in Hot Standby mode, where the * KnownAssignedXids machinery requires tracking every XID assignment. It - * might be OK to skip it only when wal_level < hot_standby, but for now + * might be OK to skip it only when wal_level < replica, but for now * we don't.) * * However, if we're doing cleanup of any non-temp rels or committing any diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index f70bb49012e..b119a47e4e0 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -5866,7 +5866,7 @@ static void CheckRequiredParameterValues(void) { /* - * For archive recovery, the WAL must be generated with at least 'archive' + * For archive recovery, the WAL must be generated with at least 'replica' * wal_level. */ if (ArchiveRecoveryRequested && ControlFile->wal_level == WAL_LEVEL_MINIMAL) @@ -5877,15 +5877,15 @@ CheckRequiredParameterValues(void) } /* - * For Hot Standby, the WAL must be generated with 'hot_standby' mode, and + * For Hot Standby, the WAL must be generated with 'replica' mode, and * we must have at least as many backend slots as the primary. */ if (ArchiveRecoveryRequested && EnableHotStandby) { - if (ControlFile->wal_level < WAL_LEVEL_HOT_STANDBY) + if (ControlFile->wal_level < WAL_LEVEL_REPLICA) ereport(ERROR, - (errmsg("hot standby is not possible because wal_level was not set to \"hot_standby\" or higher on the master server"), - errhint("Either set wal_level to \"hot_standby\" on the master, or turn off hot_standby here."))); + (errmsg("hot standby is not possible because wal_level was not set to \"replica\" or higher on the master server"), + errhint("Either set wal_level to \"replica\" on the master, or turn off hot_standby here."))); /* We ignore autovacuum_max_workers when we make this test. */ RecoveryRequiresIntParameter("max_connections", @@ -9459,10 +9459,8 @@ xlog_redo(XLogReaderState *record) /* * Update minRecoveryPoint to ensure that if recovery is aborted, we * recover back up to this point before allowing hot standby again. - * This is particularly important if wal_level was set to 'archive' - * before, and is now 'hot_standby', to ensure you don't run queries - * against the WAL preceding the wal_level change. Same applies to - * decreasing max_* settings. + * This is important if the max_* settings are decreased, to ensure + * you don't run queries against the WAL preceding the change. */ minRecoveryPoint = ControlFile->minRecoveryPoint; minRecoveryPointTLI = ControlFile->minRecoveryPointTLI; @@ -9793,7 +9791,7 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p, ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("WAL level not sufficient for making an online backup"), - errhint("wal_level must be set to \"archive\", \"hot_standby\", or \"logical\" at server start."))); + errhint("wal_level must be set to \"replica\" or \"logical\" at server start."))); if (strlen(backupidstr) > MAXPGPATH) ereport(ERROR, @@ -10264,7 +10262,7 @@ do_pg_stop_backup(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("WAL level not sufficient for making an online backup"), - errhint("wal_level must be set to \"archive\", \"hot_standby\", or \"logical\" at server start."))); + errhint("wal_level must be set to \"replica\" or \"logical\" at server start."))); /* * OK to update backup counters and forcePageWrites diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c index 31cbb01ce47..9ec6b2ae4f1 100644 --- a/src/backend/access/transam/xlogfuncs.c +++ b/src/backend/access/transam/xlogfuncs.c @@ -154,7 +154,7 @@ pg_create_restore_point(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("WAL level not sufficient for creating a restore point"), - errhint("wal_level must be set to \"archive\", \"hot_standby\", or \"logical\" at server start."))); + errhint("wal_level must be set to \"replica\" or \"logical\" at server start."))); restore_name_str = text_to_cstring(restore_name); diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index b16fc28a27d..6cf51e1b64d 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -858,7 +858,7 @@ PostmasterMain(int argc, char *argv[]) (errmsg("WAL archival cannot be enabled when wal_level is \"minimal\""))); if (max_wal_senders > 0 && wal_level == WAL_LEVEL_MINIMAL) ereport(ERROR, - (errmsg("WAL streaming (max_wal_senders > 0) requires wal_level \"archive\", \"hot_standby\", or \"logical\""))); + (errmsg("WAL streaming (max_wal_senders > 0) requires wal_level \"replica\" or \"logical\""))); /* * Other one-time internal sanity checks can go here, if they are fast. diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c index ead221d3c75..c13be753ea9 100644 --- a/src/backend/replication/slot.c +++ b/src/backend/replication/slot.c @@ -760,7 +760,7 @@ CheckSlotRequirements(void) (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errmsg("replication slots can only be used if max_replication_slots > 0")))); - if (wal_level < WAL_LEVEL_ARCHIVE) + if (wal_level < WAL_LEVEL_REPLICA) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("replication slots can only be used if wal_level >= archive"))); diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 773b4e8a4fc..5536012e050 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -173,7 +173,7 @@ # - Settings - -#wal_level = minimal # minimal, archive, hot_standby, or logical +#wal_level = minimal # minimal, replica, or logical # (change requires restart) #fsync = on # turns forced synchronization on or off #synchronous_commit = on # synchronization level; diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl index e097619310f..f4769bf535d 100644 --- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl +++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl @@ -43,7 +43,7 @@ $node->command_fails( open CONF, ">>$pgdata/postgresql.conf"; print CONF "max_replication_slots = 10\n"; print CONF "max_wal_senders = 10\n"; -print CONF "wal_level = archive\n"; +print CONF "wal_level = replica\n"; close CONF; $node->restart; diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c index fdf7c7de9b6..96619a20769 100644 --- a/src/bin/pg_controldata/pg_controldata.c +++ b/src/bin/pg_controldata/pg_controldata.c @@ -73,10 +73,8 @@ wal_level_str(WalLevel wal_level) { case WAL_LEVEL_MINIMAL: return "minimal"; - case WAL_LEVEL_ARCHIVE: - return "archive"; - case WAL_LEVEL_HOT_STANDBY: - return "hot_standby"; + case WAL_LEVEL_REPLICA: + return "replica"; case WAL_LEVEL_LOGICAL: return "logical"; } diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index ecd30ce3ce2..74a139496e6 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -121,25 +121,24 @@ extern int XLogArchiveMode; typedef enum WalLevel { WAL_LEVEL_MINIMAL = 0, - WAL_LEVEL_ARCHIVE, - WAL_LEVEL_HOT_STANDBY, + WAL_LEVEL_REPLICA, WAL_LEVEL_LOGICAL } WalLevel; extern int wal_level; /* Is WAL archiving enabled (always or only while server is running normally)? */ #define XLogArchivingActive() \ - (XLogArchiveMode > ARCHIVE_MODE_OFF && wal_level >= WAL_LEVEL_ARCHIVE) + (AssertMacro(XLogArchiveMode == ARCHIVE_MODE_OFF || wal_level >= WAL_LEVEL_REPLICA), XLogArchiveMode > ARCHIVE_MODE_OFF) /* Is WAL archiving enabled always (even during recovery)? */ #define XLogArchivingAlways() \ - (XLogArchiveMode == ARCHIVE_MODE_ALWAYS && wal_level >= WAL_LEVEL_ARCHIVE) + (AssertMacro(XLogArchiveMode == ARCHIVE_MODE_OFF || wal_level >= WAL_LEVEL_REPLICA), XLogArchiveMode == ARCHIVE_MODE_ALWAYS) #define XLogArchiveCommandSet() (XLogArchiveCommand[0] != '\0') /* * Is WAL-logging necessary for archival or log-shipping, or can we skip * WAL-logging if we fsync() the data before committing instead? */ -#define XLogIsNeeded() (wal_level >= WAL_LEVEL_ARCHIVE) +#define XLogIsNeeded() (wal_level >= WAL_LEVEL_REPLICA) /* * Is a full-page image needed for hint bit updates? @@ -153,7 +152,7 @@ extern int wal_level; #define XLogHintBitIsNeeded() (DataChecksumsEnabled() || wal_log_hints) /* Do we need to WAL-log information required only for Hot Standby and logical replication? */ -#define XLogStandbyInfoActive() (wal_level >= WAL_LEVEL_HOT_STANDBY) +#define XLogStandbyInfoActive() (wal_level >= WAL_LEVEL_REPLICA) /* Do we need to WAL-log information required only for logical replication? */ #define XLogLogicalInfoActive() (wal_level >= WAL_LEVEL_LOGICAL) diff --git a/src/include/catalog/pg_control.h b/src/include/catalog/pg_control.h index 86fbdce0e82..7ba396df515 100644 --- a/src/include/catalog/pg_control.h +++ b/src/include/catalog/pg_control.h @@ -54,7 +54,7 @@ typedef struct CheckPoint /* * Oldest XID still running. This is only needed to initialize hot standby * mode from an online checkpoint, so we only bother calculating this for - * online checkpoints and only when wal_level is hot_standby. Otherwise + * online checkpoints and only when wal_level is replica. Otherwise * it's set to InvalidTransactionId. */ TransactionId oldestActiveXid; diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm index 090d48c4067..1eedd19c8a8 100644 --- a/src/test/perl/PostgresNode.pm +++ b/src/test/perl/PostgresNode.pm @@ -404,7 +404,7 @@ sub init if ($params{allows_streaming}) { - print $conf "wal_level = hot_standby\n"; + print $conf "wal_level = replica\n"; print $conf "max_wal_senders = 5\n"; print $conf "wal_keep_segments = 20\n"; print $conf "max_wal_size = 128MB\n"; |