Commit 1a37056a authored by Tom Lane's avatar Tom Lane

Re-enable the old code in xlog.c that tried to use posix_fadvise(), so that

we can get some buildfarm feedback about whether that function is still
problematic.  (Note that the planned async-preread patch will not really
prove anything one way or the other in buildfarm testing, since it will
be inactive with default GUC settings.)
parent a5d67a0a
...@@ -16238,7 +16238,8 @@ fi ...@@ -16238,7 +16238,8 @@ fi
for ac_func in cbrt dlopen fcvt fdatasync getpeereid getpeerucred getrlimit memmove poll pstat readlink setproctitle setsid sigprocmask symlink sysconf towlower utime utimes waitpid wcstombs
for ac_func in cbrt dlopen fcvt fdatasync getpeereid getpeerucred getrlimit memmove poll posix_fadvise pstat readlink setproctitle setsid sigprocmask symlink sysconf towlower utime utimes waitpid wcstombs
do do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_func" >&5 { echo "$as_me:$LINENO: checking for $ac_func" >&5
......
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
dnl $PostgreSQL: pgsql/configure.in,v 1.584 2009/01/07 10:38:44 petere Exp $ dnl $PostgreSQL: pgsql/configure.in,v 1.585 2009/01/11 18:02:17 tgl Exp $
dnl dnl
dnl Developers, please strive to achieve this order: dnl Developers, please strive to achieve this order:
dnl dnl
...@@ -1137,7 +1137,7 @@ PGAC_VAR_INT_TIMEZONE ...@@ -1137,7 +1137,7 @@ PGAC_VAR_INT_TIMEZONE
AC_FUNC_ACCEPT_ARGTYPES AC_FUNC_ACCEPT_ARGTYPES
PGAC_FUNC_GETTIMEOFDAY_1ARG PGAC_FUNC_GETTIMEOFDAY_1ARG
AC_CHECK_FUNCS([cbrt dlopen fcvt fdatasync getpeereid getpeerucred getrlimit memmove poll pstat readlink setproctitle setsid sigprocmask symlink sysconf towlower utime utimes waitpid wcstombs]) AC_CHECK_FUNCS([cbrt dlopen fcvt fdatasync getpeereid getpeerucred getrlimit memmove poll posix_fadvise pstat readlink setproctitle setsid sigprocmask symlink sysconf towlower utime utimes waitpid wcstombs])
AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>]) AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
AC_CHECK_DECLS(posix_fadvise, [], [], [#include <fcntl.h>]) AC_CHECK_DECLS(posix_fadvise, [], [], [#include <fcntl.h>])
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.326 2009/01/01 17:23:36 momjian Exp $ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.327 2009/01/11 18:02:17 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <ctype.h> #include <ctype.h>
#include <signal.h> #include <signal.h>
#include <time.h> #include <time.h>
#include <fcntl.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/wait.h> #include <sys/wait.h>
...@@ -2435,30 +2436,18 @@ XLogFileClose(void) ...@@ -2435,30 +2436,18 @@ XLogFileClose(void)
{ {
Assert(openLogFile >= 0); Assert(openLogFile >= 0);
/*
* posix_fadvise is problematic on many platforms: on older x86 Linux it
* just dumps core, and there are reports of problems on PPC platforms as
* well. The following is therefore disabled for the time being. We could
* consider some kind of configure test to see if it's safe to use, but
* since we lack hard evidence that there's any useful performance gain to
* be had, spending time on that seems unprofitable for now.
*/
#ifdef NOT_USED
/* /*
* WAL segment files will not be re-read in normal operation, so we advise * WAL segment files will not be re-read in normal operation, so we advise
* OS to release any cached pages. But do not do so if WAL archiving is * the OS to release any cached pages. But do not do so if WAL archiving
* active, because archiver process could use the cache to read the WAL * is active, because archiver process could use the cache to read the WAL
* segment. * segment. Also, don't bother with it if we are using O_DIRECT, since
* * the kernel is presumably not caching in that case.
* While O_DIRECT works for O_SYNC, posix_fadvise() works for fsync() and */
* O_SYNC, and some platforms only have posix_fadvise(). #if defined(USE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED)
*/ if (!XLogArchivingActive() &&
#if defined(HAVE_DECL_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED) (get_sync_bit(sync_method) & PG_O_DIRECT) == 0)
if (!XLogArchivingActive()) (void) posix_fadvise(openLogFile, 0, 0, POSIX_FADV_DONTNEED);
posix_fadvise(openLogFile, 0, 0, POSIX_FADV_DONTNEED);
#endif #endif
#endif /* NOT_USED */
if (close(openLogFile)) if (close(openLogFile))
ereport(PANIC, ereport(PANIC,
......
...@@ -336,6 +336,9 @@ ...@@ -336,6 +336,9 @@
/* Define to 1 if you have the <poll.h> header file. */ /* Define to 1 if you have the <poll.h> header file. */
#undef HAVE_POLL_H #undef HAVE_POLL_H
/* Define to 1 if you have the `posix_fadvise' function. */
#undef HAVE_POSIX_FADVISE
/* Define to 1 if you have the POSIX signal interface. */ /* Define to 1 if you have the POSIX signal interface. */
#undef HAVE_POSIX_SIGNALS #undef HAVE_POSIX_SIGNALS
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* for developers. If you edit any of these, be sure to do a *full* * for developers. If you edit any of these, be sure to do a *full*
* rebuild (and an initdb if noted). * rebuild (and an initdb if noted).
* *
* $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.35 2008/07/12 02:28:43 tgl Exp $ * $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.36 2009/01/11 18:02:17 tgl Exp $
*------------------------------------------------------------------------ *------------------------------------------------------------------------
*/ */
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
#define ALIGNOF_BUFFER 32 #define ALIGNOF_BUFFER 32
/* /*
* Disable UNIX sockets for those operating system. * Disable UNIX sockets for certain operating systems.
*/ */
#if defined(WIN32) #if defined(WIN32)
#undef HAVE_UNIX_SOCKETS #undef HAVE_UNIX_SOCKETS
...@@ -125,6 +125,16 @@ ...@@ -125,6 +125,16 @@
#define HAVE_WORKING_LINK 1 #define HAVE_WORKING_LINK 1
#endif #endif
/*
* USE_POSIX_FADVISE controls whether Postgres will attempt to use the
* posix_fadvise() kernel call. Usually the automatic configure tests are
* sufficient, but some older Linux distributions had broken versions of
* posix_fadvise(). If necessary you can remove the #define here.
*/
#if HAVE_DECL_POSIX_FADVISE && defined(HAVE_POSIX_FADVISE)
#define USE_POSIX_FADVISE
#endif
/* /*
* This is the default directory in which AF_UNIX socket files are * This is the default directory in which AF_UNIX socket files are
* placed. Caution: changing this risks breaking your existing client * placed. Caution: changing this risks breaking your existing client
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment