aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/init/flatfiles.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-08-01 22:45:09 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-08-01 22:45:09 +0000
commit4a78cdeb6b598940e9d9adb92deca6494628802a (patch)
tree0c8ad45eea297dcbc647705265eab8188fd4d8b1 /src/backend/utils/init/flatfiles.c
parentc722628a430f347ff4a30419004cddc9795a3bb6 (diff)
downloadpostgresql-4a78cdeb6b598940e9d9adb92deca6494628802a.tar.gz
postgresql-4a78cdeb6b598940e9d9adb92deca6494628802a.zip
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.
Diffstat (limited to 'src/backend/utils/init/flatfiles.c')
-rw-r--r--src/backend/utils/init/flatfiles.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/backend/utils/init/flatfiles.c b/src/backend/utils/init/flatfiles.c
index 992fc70bb44..c9b1ac509c2 100644
--- a/src/backend/utils/init/flatfiles.c
+++ b/src/backend/utils/init/flatfiles.c
@@ -23,7 +23,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/utils/init/flatfiles.c,v 1.26 2007/06/12 17:16:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/init/flatfiles.c,v 1.27 2007/08/01 22:45:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -855,6 +855,14 @@ AtEOXact_UpdateFlatFiles(bool isCommit)
* Signal the postmaster to reload its caches.
*/
SendPostmasterSignal(PMSIGNAL_PASSWORD_CHANGE);
+
+ /*
+ * Force synchronous commit, to minimize the window between changing
+ * the flat files on-disk and marking the transaction committed. It's
+ * not great that there is any window at all, but definitely we don't
+ * want to make it larger than necessary.
+ */
+ ForceSyncCommit();
}