summaryrefslogtreecommitdiff
path: root/src/backend/utils
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2010-04-28 16:10:43 +0000
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2010-04-28 16:10:43 +0000
commit9b8a73326e99821caf33c36c081cb307e17422d4 (patch)
tree6ba969ff6d18829c87fde36b9608f4d051cc7b8c /src/backend/utils
parenta2de4826e912057a9a3c44e6c4c204dfa3b753a9 (diff)
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.
Diffstat (limited to 'src/backend/utils')
-rw-r--r--src/backend/utils/misc/guc.c14
-rw-r--r--src/backend/utils/misc/postgresql.conf.sample1
2 files changed, 13 insertions, 2 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index e7266d5fb10..2404da84419 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.551 2010/04/22 19:40:03 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.552 2010/04/28 16:10:42 heikki Exp $
*
*--------------------------------------------------------------------
*/
@@ -340,6 +340,7 @@ static const struct config_enum_entry constraint_exclusion_options[] = {
/*
* Options for enum values stored in other modules
*/
+extern const struct config_enum_entry wal_level_options[];
extern const struct config_enum_entry sync_method_options[];
/*
@@ -2785,6 +2786,15 @@ static struct config_enum ConfigureNamesEnum[] =
},
{
+ {"wal_level", PGC_POSTMASTER, WAL_SETTINGS,
+ gettext_noop("Set the level of information written to the WAL."),
+ NULL
+ },
+ &wal_level,
+ WAL_LEVEL_MINIMAL, wal_level_options, NULL
+ },
+
+ {
{"wal_sync_method", PGC_SIGHUP, WAL_SETTINGS,
gettext_noop("Selects the method used for forcing WAL updates to disk."),
NULL
@@ -7862,7 +7872,7 @@ pg_timezone_abbrev_initialize(void)
static const char *
show_archive_command(void)
{
- if (XLogArchiveMode)
+ if (XLogArchivingActive())
return XLogArchiveCommand;
else
return "(disabled)";
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 92763eb523a..57497115689 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -150,6 +150,7 @@
# - Settings -
+#wal_level = minimal # minimal, archive, or hot_standby
#fsync = on # turns forced synchronization on or off
#synchronous_commit = on # immediate fsync at commit
#wal_sync_method = fsync # the default is the first option