From 4a78cdeb6b598940e9d9adb92deca6494628802a Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 1 Aug 2007 22:45:09 +0000 Subject: Support an optional asynchronous commit mode, in which we don't flush WAL before reporting a transaction committed. Data consistency is still guaranteed (unlike setting fsync = off), but a crash may lose the effects of the last few transactions. Patch by Simon, some editorialization by Tom. --- src/backend/utils/misc/guc.c | 14 +++++++++++--- src/backend/utils/misc/postgresql.conf.sample | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src/backend/utils/misc') diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index b2d0ea9cae5..c30d8b50a05 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut . * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.407 2007/07/24 04:54:09 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.408 2007/08/01 22:45:09 tgl Exp $ * *-------------------------------------------------------------------- */ @@ -553,6 +553,14 @@ static struct config_bool ConfigureNamesBool[] = &enableFsync, true, NULL, NULL }, + { + {"synchronous_commit", PGC_USERSET, WAL_SETTINGS, + gettext_noop("Sets immediate fsync at commit."), + NULL + }, + &XactSyncCommit, + true, NULL, NULL + }, { {"zero_damaged_pages", PGC_SUSET, DEVELOPER_OPTIONS, gettext_noop("Continues processing past damaged page headers."), @@ -1521,7 +1529,7 @@ static struct config_int ConfigureNamesInt[] = }, { - {"commit_delay", PGC_USERSET, WAL_CHECKPOINTS, + {"commit_delay", PGC_USERSET, WAL_SETTINGS, gettext_noop("Sets the delay in microseconds between transaction commit and " "flushing WAL to disk."), NULL @@ -1531,7 +1539,7 @@ static struct config_int ConfigureNamesInt[] = }, { - {"commit_siblings", PGC_USERSET, WAL_CHECKPOINTS, + {"commit_siblings", PGC_USERSET, WAL_SETTINGS, gettext_noop("Sets the minimum concurrent open transactions before performing " "commit_delay."), NULL diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 8bfad997ff3..c87e4baf43d 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -149,6 +149,7 @@ # - Settings - #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 # supported by the operating system: # open_datasync -- cgit v1.2.3