> Please find attached a patch doing what is written in the $subject. With the documentation updated, this is even better... Regards, -- Michael
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml index ccb76d8..0f20253 100644 --- a/doc/src/sgml/backup.sgml +++ b/doc/src/sgml/backup.sgml @@ -582,7 +582,7 @@ tar -cf backup.tar /usr/local/pgsql/data <para> To enable WAL archiving, set the <xref linkend="guc-wal-level"> - configuration parameter to <literal>archive</> (or <literal>hot_standby</>), + configuration parameter to <literal>hot_standby</>, <xref linkend="guc-archive-mode"> to <literal>on</>, and specify the shell command to use in the <xref linkend="guc-archive-command"> configuration parameter. In practice @@ -1246,7 +1246,7 @@ restore_command = 'cp /mnt/server/archivedir/%f %p' If more flexibility in copying the backup files is needed, a lower level process can be used for standalone hot backups as well. To prepare for low level standalone hot backups, set <varname>wal_level</> to - <literal>archive</> (or <literal>hot_standby</>), <varname>archive_mode</> to + <literal>hot_standby</>, <varname>archive_mode</> to <literal>on</>, and set up an <varname>archive_command</> that performs archiving only when a <emphasis>switch file</> exists. For example: <programlisting> diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 77a9303..2c6a022 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -1606,10 +1606,9 @@ include 'filename' <varname>wal_level</> determines how much information is written to the WAL. The default value is <literal>minimal</>, which writes only the information needed to recover from a crash or immediate - shutdown. <literal>archive</> adds logging required for WAL archiving, - and <literal>hot_standby</> further adds information required to run - read-only queries on a standby server. - This parameter can only be set at server start. + shutdown. <literal>hot_standby</> adds logging required for WAL + archiving and information required to run read-only queries on a + standby server. This parameter can only be set at server start. </para> <para> In <literal>minimal</> level, WAL-logging of some bulk @@ -1625,22 +1624,17 @@ include 'filename' </simplelist> But minimal WAL does not contain enough information to reconstruct the data from a base backup and the - WAL logs, so either <literal>archive</> or <literal>hot_standby</> - level must be used to enable + WAL logs <literal>hot_standby</> level must be used to enable WAL archiving (<xref linkend="guc-archive-mode">) and streaming replication. </para> <para> - In <literal>hot_standby</> level, the same information is logged as - with <literal>archive</>, plus information needed to reconstruct - the status of running transactions from the WAL. To enable read-only - queries on a standby server, <varname>wal_level</> must be set to - <literal>hot_standby</> on the primary, and - <xref linkend="guc-hot-standby"> must be enabled in the standby. It is - thought that there is - little measurable difference in performance between using - <literal>hot_standby</> and <literal>archive</> levels, so feedback - is welcome if any production impacts are noticeable. + In <literal>hot_standby</> level, necessary information is logged + to reconstruct the status of running transactions from the WAL and + to enable read-only queries on a standby server. Note that + <varname>wal_level</> must be set to <literal>hot_standby</> on + the primary, and <xref linkend="guc-hot-standby"> must be enabled + in the standby. </para> </listitem> </varlistentry> @@ -2198,8 +2192,8 @@ include 'filename' of connections, so the parameter cannot be set higher than <xref linkend="guc-max-connections">. This parameter can only be set at server start. <varname>wal_level</> must be set - to <literal>archive</> or <literal>hot_standby</> to allow - connections from standby servers. + to <literal>hot_standby</> to allow connections from standby + servers. </para> </listitem> </varlistentry> diff --git a/src/backend/access/nbtree/nbtpage.c b/src/backend/access/nbtree/nbtpage.c index f407753..3333af4 100644 --- a/src/backend/access/nbtree/nbtpage.c +++ b/src/backend/access/nbtree/nbtpage.c @@ -630,7 +630,7 @@ _bt_getbuf(Relation rel, BlockNumber blkno, int access) * WAL record that will allow us to conflict with queries * running on standby. */ - if (XLogStandbyInfoActive()) + if (XLogIsNeeded()) { BTPageOpaque opaque = (BTPageOpaque) PageGetSpecialPointer(page); diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c index 073190f..81f7c75 100644 --- a/src/backend/access/nbtree/nbtree.c +++ b/src/backend/access/nbtree/nbtree.c @@ -826,7 +826,7 @@ btvacuumscan(IndexVacuumInfo *info, IndexBulkDeleteResult *stats, * take care to issue the record for last actual block and not for the * last block that was scanned. Ignore empty indexes. */ - if (XLogStandbyInfoActive() && + if (XLogIsNeeded() && num_pages > 1 && vstate.lastBlockVacuumed < (num_pages - 1)) { Buffer buf; diff --git a/src/backend/access/rmgrdesc/xlogdesc.c b/src/backend/access/rmgrdesc/xlogdesc.c index 1b36f9a..4735cfb 100644 --- a/src/backend/access/rmgrdesc/xlogdesc.c +++ b/src/backend/access/rmgrdesc/xlogdesc.c @@ -26,7 +26,6 @@ */ 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}, {NULL, 0, false} }; diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 0591f3f..75e87f9 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -520,7 +520,7 @@ AssignTransactionId(TransactionState s) * recovery only because aborted subtransactions are separately WAL * logged. */ - if (isSubXact && XLogStandbyInfoActive()) + if (isSubXact && XLogIsNeeded()) { unreportedXids[nUnreportedXids] = s->transactionId; nUnreportedXids++; @@ -969,7 +969,7 @@ RecordTransactionCommit(void) /* Get data needed for commit record */ nrels = smgrGetPendingDeletes(true, &rels); nchildren = xactGetCommittedChildren(&children); - if (XLogStandbyInfoActive()) + if (XLogIsNeeded()) nmsgs = xactGetCommittedInvalidationMessages(&invalMessages, &RelcacheInitFileInval); wrote_xlog = (XactLastRecEnd != 0); diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 06f5eb0..61d28e5 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -7994,7 +7994,7 @@ CreateCheckPoint(int flags) * pointer. This allows us to begin accumulating changes to assemble our * starting snapshot of locks and transactions. */ - if (!shutdown && XLogStandbyInfoActive()) + if (!shutdown && XLogIsNeeded()) checkPoint.oldestActiveXid = GetOldestActiveTransactionId(); else checkPoint.oldestActiveXid = InvalidTransactionId; @@ -8189,7 +8189,7 @@ CreateCheckPoint(int flags) * If we are shutting down, or Startup process is completing crash * recovery we don't need to write running xact data. */ - if (!shutdown && XLogStandbyInfoActive()) + if (!shutdown && XLogIsNeeded()) LogStandbySnapshot(); START_CRIT_SECTION(); @@ -8990,7 +8990,7 @@ UpdateFullPageWrites(void) * Write an XLOG_FPW_CHANGE record. This allows us to keep track of * full_page_writes during archive recovery, if required. */ - if (XLogStandbyInfoActive() && !RecoveryInProgress()) + if (XLogIsNeeded() && !RecoveryInProgress()) { XLogRecData rdata; diff --git a/src/backend/storage/ipc/standby.c b/src/backend/storage/ipc/standby.c index c704412..6fd8988 100644 --- a/src/backend/storage/ipc/standby.c +++ b/src/backend/storage/ipc/standby.c @@ -753,7 +753,7 @@ StandbyReleaseOldLocks(int nxids, TransactionId *xids) * -------------------------------------------------------------------- * Recovery handling for Rmgr RM_STANDBY_ID * - * These record types will only be created if XLogStandbyInfoActive() + * These record types will only be created if XLogIsNeeded() * -------------------------------------------------------------------- */ @@ -861,7 +861,7 @@ LogStandbySnapshot(void) xl_standby_lock *locks; int nlocks; - Assert(XLogStandbyInfoActive()); + Assert(XLogIsNeeded()); /* * Get details of any AccessExclusiveLocks being held at the moment. diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c index f4f32e9..5cc8c0e 100644 --- a/src/backend/storage/lmgr/lock.c +++ b/src/backend/storage/lmgr/lock.c @@ -800,7 +800,7 @@ LockAcquireExtended(const LOCKTAG *locktag, if (lockmode >= AccessExclusiveLock && locktag->locktag_type == LOCKTAG_RELATION && !RecoveryInProgress() && - XLogStandbyInfoActive()) + XLogIsNeeded()) { LogAccessExclusiveLockPrepare(); log_lock = true; diff --git a/src/bin/pg_controldata/pg_controldata.c b/src/bin/pg_controldata/pg_controldata.c index fde483a..655b0b5 100644 --- a/src/bin/pg_controldata/pg_controldata.c +++ b/src/bin/pg_controldata/pg_controldata.c @@ -73,8 +73,6 @@ 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"; } diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h index 002862c..1a89034 100644 --- a/src/include/access/xlog.h +++ b/src/include/access/xlog.h @@ -196,22 +196,18 @@ extern int num_xloginsert_slots; typedef enum WalLevel { WAL_LEVEL_MINIMAL = 0, - WAL_LEVEL_ARCHIVE, WAL_LEVEL_HOT_STANDBY } WalLevel; extern int wal_level; -#define XLogArchivingActive() (XLogArchiveMode && wal_level >= WAL_LEVEL_ARCHIVE) +#define XLogArchivingActive() (XLogArchiveMode && wal_level >= WAL_LEVEL_HOT_STANDBY) #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? + * Is WAL-logging necessary for log-shipping, or can we skip WAL-logging if we + * fsync() the data before committing instead? */ -#define XLogIsNeeded() (wal_level >= WAL_LEVEL_ARCHIVE) - -/* Do we need to WAL-log information required only for Hot Standby? */ -#define XLogStandbyInfoActive() (wal_level >= WAL_LEVEL_HOT_STANDBY) +#define XLogIsNeeded() (wal_level >= WAL_LEVEL_HOT_STANDBY) #ifdef WAL_DEBUG extern bool XLOG_DEBUG;
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers