mirror of
https://github.com/postgres/postgres.git
synced 2025-08-28 18:48:04 +03:00
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.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.202 2010/02/26 02:00:37 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.203 2010/04/28 16:10:41 heikki Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -787,23 +787,6 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
|
||||
*/
|
||||
use_wal = XLogIsNeeded() && !NewHeap->rd_istemp;
|
||||
|
||||
/*
|
||||
* Write an XLOG UNLOGGED record if WAL-logging was skipped because WAL
|
||||
* archiving is not enabled.
|
||||
*/
|
||||
if (!use_wal && !NewHeap->rd_istemp)
|
||||
{
|
||||
char reason[NAMEDATALEN + 32];
|
||||
|
||||
if (OldIndex != NULL)
|
||||
snprintf(reason, sizeof(reason), "CLUSTER on \"%s\"",
|
||||
RelationGetRelationName(NewHeap));
|
||||
else
|
||||
snprintf(reason, sizeof(reason), "VACUUM FULL on \"%s\"",
|
||||
RelationGetRelationName(NewHeap));
|
||||
XLogReportUnloggedStatement(reason);
|
||||
}
|
||||
|
||||
/* use_wal off requires smgr_targblock be initially invalid */
|
||||
Assert(RelationGetTargetBlock(NewHeap) == InvalidBlockNumber);
|
||||
|
||||
|
Reference in New Issue
Block a user