Skip to content

Commit 7d23e0f

Browse files
committed
Update C comment about O_DIRECT and fsync().
1 parent 06711de commit 7d23e0f

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/include/access/xlogdefs.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,12 @@ typedef uint32 TimeLineID;
8585

8686
/*
8787
* Because O_DIRECT bypasses the kernel buffers, and because we never
88-
* read those buffers except during crash recovery, it is a win to use
89-
* it in all cases where we sync on each write(). We could allow O_DIRECT
90-
* with fsync(), but because skipping the kernel buffer forces writes out
91-
* quickly, it seems best just to use it for O_SYNC. It is hard to imagine
92-
* how fsync() could be a win for O_DIRECT compared to O_SYNC and O_DIRECT.
93-
* Also, O_DIRECT is never enough to force data to the drives, it merely
94-
* tries to bypass the kernel cache, so we still need O_SYNC or fsync().
88+
* read those buffers except during crash recovery or if wal_level != minimal,
89+
* it is a win to use it in all cases where we sync on each write(). We could
90+
* allow O_DIRECT with fsync(), but it is unclear if fsync() could process
91+
* writes not buffered in the kernel. Also, O_DIRECT is never enough to force
92+
* data to the drives, it merely tries to bypass the kernel cache, so we still
93+
* need O_SYNC/O_DSYNC.
9594
*/
9695
#ifdef O_DIRECT
9796
#define PG_O_DIRECT O_DIRECT

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