https://github.com/postgres/postgres
Revision cb867853a17e4055d58a8639ed4a23652e2ce8e0 authored by Tom Lane on 28 May 2015, 21:33:03 UTC, committed by Tom Lane on 28 May 2015, 21:33:03 UTC
Commit 2ce439f3379aed857517c8ce207485655000fc8e introduced a rather serious
regression, namely that if its scan of the data directory came across any
un-fsync-able files, it would fail and thereby prevent database startup.
Worse yet, symlinks to such files also caused the problem, which meant that
crash restart was guaranteed to fail on certain common installations such
as older Debian.

After discussion, we agreed that (1) failure to start is worse than any
consequence of not fsync'ing is likely to be, therefore treat all errors
in this code as nonfatal; (2) we should not chase symlinks other than
those that are expected to exist, namely pg_xlog/ and tablespace links
under pg_tblspc/.  The latter restriction avoids possibly fsync'ing a
much larger part of the filesystem than intended, if the user has left
random symlinks hanging about in the data directory.

This commit takes care of that and also does some code beautification,
mainly moving the relevant code into fd.c, which seems a much better place
for it than xlog.c, and making sure that the conditional compilation for
the pre_sync_fname pass has something to do with whether pg_flush_data
works.

I also relocated the call site in xlog.c down a few lines; it seems a
bit silly to be doing this before ValidateXLOGDirectoryStructure().

The similar logic in initdb.c ought to be made to match this, but that
change is noncritical and will be dealt with separately.

Back-patch to all active branches, like the prior commit.

Abhijit Menon-Sen and Tom Lane
1 parent ee8b93c
History
Tip revision: cb867853a17e4055d58a8639ed4a23652e2ce8e0 authored by Tom Lane on 28 May 2015, 21:33:03 UTC
Fix fsync-at-startup code to not treat errors as fatal.
Tip revision: cb86785
File Mode Size
config
contrib
doc
src
.gitignore -rw-r--r-- 360 bytes
COPYRIGHT -rw-r--r-- 1.2 KB
GNUmakefile.in -rw-r--r-- 3.5 KB
HISTORY -rw-r--r-- 283 bytes
Makefile -rw-r--r-- 1.5 KB
README -rw-r--r-- 1.2 KB
README.git -rw-r--r-- 727 bytes
aclocal.m4 -rw-r--r-- 385 bytes
configure -rwxr-xr-x 851.7 KB
configure.in -rw-r--r-- 63.7 KB

README

back to top