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/commands/tablespace.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/backend/commands/tablespace.c') 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); @@ -480,6 +488,14 @@ DropTableSpace(DropTableSpaceStmt *stmt) * entries for relations in the tablespace. */ + /* + * 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. */ -- cgit v1.2.3