Skip to content

Commit b57ddcc

Browse files
committed
Add C comment about why synchronous_commit=off behavior can lose
committed transactions in a postmaster crash.
1 parent 89474cc commit b57ddcc

File tree

1 file changed

+8
-3
lines changed
  • src/backend/access/transam

1 file changed

+8
-3
lines changed

src/backend/access/transam/xact.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.291 2010/05/13 11:39:30 sriggs Exp $
13+
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.292 2010/06/29 18:44:58 momjian Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -1028,7 +1028,7 @@ RecordTransactionCommit(void)
10281028
if (XactSyncCommit || forceSyncCommit || haveNonTemp)
10291029
{
10301030
/*
1031-
* Synchronous commit case.
1031+
* Synchronous commit case:
10321032
*
10331033
* Sleep before flush! So we can flush more than one commit records
10341034
* per single fsync. (The idea is some other backend may do the
@@ -1054,7 +1054,12 @@ RecordTransactionCommit(void)
10541054
else
10551055
{
10561056
/*
1057-
* Asynchronous commit case.
1057+
* Asynchronous commit case:
1058+
*
1059+
* This enables possible committed transaction loss in the case of a
1060+
* postmaster crash because WAL buffers are left unwritten.
1061+
* Ideally we could issue the WAL write without the fsync, but
1062+
* some wal_sync_methods do not allow separate write/fsync.
10581063
*
10591064
* Report the latest async commit LSN, so that the WAL writer knows to
10601065
* flush this commit.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy