summaryrefslogtreecommitdiff
path: root/src/backend/commands/tablespace.c
diff options
context:
space:
mode:
authorTom Lane2007-08-01 22:45:09 +0000
committerTom Lane2007-08-01 22:45:09 +0000
commit4a78cdeb6b598940e9d9adb92deca6494628802a (patch)
tree0c8ad45eea297dcbc647705265eab8188fd4d8b1 /src/backend/commands/tablespace.c
parentc722628a430f347ff4a30419004cddc9795a3bb6 (diff)
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/commands/tablespace.c')
-rw-r--r--src/backend/commands/tablespace.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index d0dacf10782..f19e237315e 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.48 2007/06/07 19:19:56 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/tablespace.c,v 1.49 2007/08/01 22:45:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -354,6 +354,14 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
(void) XLogInsert(RM_TBLSPC_ID, XLOG_TBLSPC_CREATE, rdata);
}
+ /*
+ * Force synchronous commit, to minimize the window between creating
+ * the symlink 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();
+
pfree(linkloc);
pfree(location);
@@ -481,6 +489,14 @@ DropTableSpace(DropTableSpaceStmt *stmt)
*/
/*
+ * Force synchronous commit, to minimize the window between removing
+ * the 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();
+
+ /*
* Allow TablespaceCreateDbspace again.
*/
LWLockRelease(TablespaceCreateLock);