diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-08-01 22:45:09 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-08-01 22:45:09 +0000 |
commit | 4a78cdeb6b598940e9d9adb92deca6494628802a (patch) | |
tree | 0c8ad45eea297dcbc647705265eab8188fd4d8b1 /src/backend/commands/dbcommands.c | |
parent | c722628a430f347ff4a30419004cddc9795a3bb6 (diff) | |
download | postgresql-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/commands/dbcommands.c')
-rw-r--r-- | src/backend/commands/dbcommands.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 4ceb962fb95..34b6da99df9 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.196 2007/06/28 00:02:38 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.197 2007/08/01 22:45:08 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -515,7 +515,11 @@ createdb(const CreatedbStmt *stmt) heap_close(pg_database_rel, NoLock); /* - * Set flag to update flat database file at commit. + * Set flag to update flat database file at commit. Note: this also + * forces synchronous commit, which minimizes the window between + * creation of the database files and commital of the transaction. + * If we crash before committing, we'll have a DB that's taking up + * disk space but is not in pg_database, which is not good. */ database_file_update_needed(); } @@ -675,7 +679,11 @@ dropdb(const char *dbname, bool missing_ok) heap_close(pgdbrel, NoLock); /* - * Set flag to update flat database file at commit. + * Set flag to update flat database file at commit. Note: this also + * forces synchronous commit, which minimizes the window between + * removal of the database files and commital of the transaction. + * If we crash before committing, we'll have a DB that's gone on disk + * but still there according to pg_database, which is not good. */ database_file_update_needed(); } |