Skip to content

Commit 3c71244

Browse files
committed
Put #ifdef NOT_USED around posix_fadvise call. We may want to resurrect
this someday, but right now it seems that posix_fadvise is immature to the point of being broken on many platforms ... and we don't have any benchmark evidence proving it's worth spending time on.
1 parent 33b4ad6 commit 3c71244

File tree

1 file changed

+14
-2
lines changed
  • src/backend/access/transam

1 file changed

+14
-2
lines changed

src/backend/access/transam/xlog.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.241 2006/06/22 20:42:57 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.242 2006/06/27 18:59:17 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -2153,7 +2153,16 @@ XLogFileClose(void)
21532153
{
21542154
Assert(openLogFile >= 0);
21552155

2156-
#if defined(HAVE_DECL_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED)
2156+
/*
2157+
* posix_fadvise is problematic on many platforms: on older x86 Linux
2158+
* it just dumps core, and there are reports of problems on PPC platforms
2159+
* as well. The following is therefore disabled for the time being.
2160+
* We could consider some kind of configure test to see if it's safe to
2161+
* use, but since we lack hard evidence that there's any useful performance
2162+
* gain to be had, spending time on that seems unprofitable for now.
2163+
*/
2164+
#ifdef NOT_USED
2165+
21572166
/*
21582167
* WAL segment files will not be re-read in normal operation, so we advise
21592168
* OS to release any cached pages. But do not do so if WAL archiving is
@@ -2163,10 +2172,13 @@ XLogFileClose(void)
21632172
* While O_DIRECT works for O_SYNC, posix_fadvise() works for fsync()
21642173
* and O_SYNC, and some platforms only have posix_fadvise().
21652174
*/
2175+
#if defined(HAVE_DECL_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED)
21662176
if (!XLogArchivingActive())
21672177
posix_fadvise(openLogFile, 0, 0, POSIX_FADV_DONTNEED);
21682178
#endif
21692179

2180+
#endif /* NOT_USED */
2181+
21702182
if (close(openLogFile))
21712183
ereport(PANIC,
21722184
(errcode_for_file_access(),

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