From 9b8a73326e99821caf33c36c081cb307e17422d4 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Wed, 28 Apr 2010 16:10:43 +0000 Subject: Introduce wal_level GUC to explicitly control if information needed for archival or hot standby should be WAL-logged, instead of deducing that from other options like archive_mode. This replaces recovery_connections GUC in the primary, where it now has no effect, but it's still used in the standby to enable/disable hot standby. Remove the WAL-logging of "unlogged operations", like creating an index without WAL-logging and fsyncing it at the end. Instead, we keep a copy of the wal_mode setting and the settings that affect how much shared memory a hot standby server needs to track master transactions (max_connections, max_prepared_xacts, max_locks_per_xact) in pg_control. Whenever the settings change, at server restart, write a WAL record noting the new settings and update pg_control. This allows us to notice the change in those settings in the standby at the right moment, they used to be included in checkpoint records, but that meant that a changed value was not reflected in the standby until the first checkpoint after the change. Bump PG_CONTROL_VERSION and XLOG_PAGE_MAGIC. Whack XLOG_PAGE_MAGIC back to the sequence it used to follow, before hot standby and subsequent patches changed it to 0x9003. --- src/backend/commands/tablecmds.c | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) (limited to 'src/backend/commands/tablecmds.c') diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index dda0b2e847..18e2f57128 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.329 2010/03/20 00:43:42 rhaas Exp $ + * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.330 2010/04/28 16:10:41 heikki Exp $ * *------------------------------------------------------------------------- */ @@ -3272,14 +3272,7 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap) /* If we skipped writing WAL, then we need to sync the heap. */ if (hi_options & HEAP_INSERT_SKIP_WAL) - { - char reason[NAMEDATALEN + 30]; - - snprintf(reason, sizeof(reason), "table rewrite on \"%s\"", - RelationGetRelationName(newrel)); - XLogReportUnloggedStatement(reason); heap_sync(newrel); - } heap_close(newrel, NoLock); } @@ -7021,20 +7014,6 @@ ATExecSetTableSpace(Oid tableOid, Oid newTableSpace) heap_close(pg_class, RowExclusiveLock); - /* - * Write an XLOG UNLOGGED record if WAL-logging was skipped because WAL - * archiving is not enabled. - */ - if (!XLogIsNeeded() && !rel->rd_istemp) - { - char reason[NAMEDATALEN + 40]; - - snprintf(reason, sizeof(reason), "ALTER TABLE SET TABLESPACE on \"%s\"", - RelationGetRelationName(rel)); - - XLogReportUnloggedStatement(reason); - } - relation_close(rel, NoLock); /* Make sure the reltablespace change is visible */ @@ -7063,10 +7042,6 @@ copy_relation_data(SMgrRelation src, SMgrRelation dst, /* * We need to log the copied data in WAL iff WAL archiving/streaming is * enabled AND it's not a temp rel. - * - * Note: If you change the conditions here, update the conditions in - * ATExecSetTableSpace() for when an XLOG UNLOGGED record is written to - * match. */ use_wal = XLogIsNeeded() && !istemp; -- cgit v1.2.1