1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +03:00

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.
This commit is contained in:
Tom Lane
2007-08-01 22:45:09 +00:00
parent c722628a43
commit 4a78cdeb6b
25 changed files with 998 additions and 303 deletions

View File

@ -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();
}