Re: [HACKERS] Removal of archive in wal_level
On Mon, Nov 4, 2013 at 11:45 AM, Stephen Frost wrote: > * Peter Eisentraut (pete...@gmx.net) wrote: >> On 11/4/13, 8:58 AM, Robert Haas wrote: >> > On Mon, Nov 4, 2013 at 5:57 AM, Michael Paquier >> > wrote: >> >>> Please find attached a patch doing what is written in the $subject. >> >> With the documentation updated, this is even better... >> > >> > I'm unconvinced that there's any value in this. >> >> Yeah, the only thing this will accomplish is to annoy people who are >> actually using that level. It would be more interesting if we could get >> rid of the wal_level setting altogether, but of course there are valid >> reasons against that. > > It would actually be valuable to 'upgrade' those people to > hot_standby, which is what I had kind of been hoping would happen > eventually. I agree that there's no use for 'archive' today, but rather > than break existing configs that use it, just make 'archive' and > 'hot_standby' mean the same thing. In the end, I'd probably vote to > make 'hot_standby' the 'legacy/deprecated' term anyway. That strikes me as a better idea than what the patch actually does, but I still think it's nanny-ism. I don't believe we have the right to second-guess the choices our users make in this area. We can make recommendations in the documentation, but at the end of the day if users choose to use archive rather than hot_standby, we should respect that choice, not break it because we think we know better. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] Removal of archive in wal_level
* Peter Eisentraut (pete...@gmx.net) wrote: > On 11/4/13, 8:58 AM, Robert Haas wrote: > > On Mon, Nov 4, 2013 at 5:57 AM, Michael Paquier > > wrote: > >>> Please find attached a patch doing what is written in the $subject. > >> With the documentation updated, this is even better... > > > > I'm unconvinced that there's any value in this. > > Yeah, the only thing this will accomplish is to annoy people who are > actually using that level. It would be more interesting if we could get > rid of the wal_level setting altogether, but of course there are valid > reasons against that. It would actually be valuable to 'upgrade' those people to hot_standby, which is what I had kind of been hoping would happen eventually. I agree that there's no use for 'archive' today, but rather than break existing configs that use it, just make 'archive' and 'hot_standby' mean the same thing. In the end, I'd probably vote to make 'hot_standby' the 'legacy/deprecated' term anyway. Thanks, Stephen signature.asc Description: Digital signature
Re: [HACKERS] Removal of archive in wal_level
On 11/4/13, 8:58 AM, Robert Haas wrote: > On Mon, Nov 4, 2013 at 5:57 AM, Michael Paquier > wrote: >>> Please find attached a patch doing what is written in the $subject. >> With the documentation updated, this is even better... > > I'm unconvinced that there's any value in this. Yeah, the only thing this will accomplish is to annoy people who are actually using that level. It would be more interesting if we could get rid of the wal_level setting altogether, but of course there are valid reasons against that. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] Removal of archive in wal_level
On Mon, Nov 4, 2013 at 5:57 AM, Michael Paquier wrote: >> Please find attached a patch doing what is written in the $subject. > With the documentation updated, this is even better... I'm unconvinced that there's any value in this. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] Removal of archive in wal_level
> 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 To enable WAL archiving, set the -configuration parameter to archive (or hot_standby), +configuration parameter to hot_standby, to on, and specify the shell command to use in the 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 wal_level to - archive (or hot_standby), archive_mode to + hot_standby, archive_mode to on, and set up an archive_command that performs archiving only when a switch file exists. For example: 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' wal_level determines how much information is written to the WAL. The default value is minimal, which writes only the information needed to recover from a crash or immediate -shutdown. archive adds logging required for WAL archiving, -and 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. 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. In minimal level, WAL-logging of some bulk @@ -1625,22 +1624,17 @@ include 'filename' But minimal WAL does not contain enough information to reconstruct the data from a base backup and the -WAL logs, so either archive or hot_standby -level must be used to enable +WAL logs hot_standby level must be used to enable WAL archiving () and streaming replication. -In hot_standby level, the same information is logged as -with archive, plus information needed to reconstruct -the status of running transactions from the WAL. To enable read-only -queries on a standby server, wal_level must be set to -hot_standby on the primary, and - must be enabled in the standby. It is -thought that there is -little measurable difference in performance between using -hot_standby and archive levels, so feedback -is welcome if any production impacts are noticeable. +In 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 +wal_level must be set to hot_standby on +the primary, and must be enabled +in the standby. @@ -2198,8 +2192,8 @@ include 'filename' of connections, so the parameter cannot be set higher than . This parameter can only be set at server start. wal_level must be set -to archive or hot_standby to allow -connections from standby servers. +to hot_standby to allow connections from standby +servers. diff --git a/src/backend/access/nbtree/nbtpage.c b/src/backend/access/nbtree/nbtpage.c index f407753..af4 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/back
[HACKERS] Removal of archive in wal_level
Hi all, Following the discussions done these last days about wal_level like this one: http://www.postgresql.org/message-id/cabuevewigm-ppobkgdkm6lzyo+ovrdz7soxn_5by8e8pcae...@mail.gmail.com Please find attached a patch doing what is written in the $subject. Thoughts? -- Michael commit 5a06f45ca85e44708e0b6ea6e9af21bc9ff8be90 Author: Michael Paquier Date: Mon Nov 4 02:33:32 2013 + Remove "archive" in wal_level archive was justifying its existence in the latest releases because users could fallback to it if there were any bugs with the latest level implemented hot_standby. There haven't been that many bugs in this area for the last couple of releases, so why not simply remove it if we also know that the performance overhead that hot_standby has compared to archive is minimal... It is also usually recommended to use hot_standby instead of archive for normal usages. diff --git a/src/backend/access/nbtree/nbtpage.c b/src/backend/access/nbtree/nbtpage.c index f407753..af4 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 XLogStandbyInfoAc