postgresql/src/include/storage
Tom Lane cb867853a1 Fix fsync-at-startup code to not treat errors as fatal.
Commit 2ce439f337 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
2015-05-28 17:33:03 -04:00
..
backendid.h pgindent run before PG 9.1 beta 1. 2011-04-10 11:42:00 -04:00
block.h Remove tabs after spaces in C comments 2014-05-06 11:26:26 -04:00
buf.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
buf_internals.h Remove tabs after spaces in C comments 2014-05-06 11:26:26 -04:00
buffile.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
bufmgr.h Fix race condition between hot standby and restoring a full-page image. 2014-11-13 20:01:09 +02:00
bufpage.h Remove tabs after spaces in C comments 2014-05-06 11:26:26 -04:00
copydir.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
fd.h Fix fsync-at-startup code to not treat errors as fatal. 2015-05-28 17:33:03 -04:00
freespace.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
fsm_internals.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
indexfsm.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
ipc.h Remove tabs after spaces in C comments 2014-05-06 11:26:26 -04:00
item.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
itemid.h Remove tabs after spaces in C comments 2014-05-06 11:26:26 -04:00
itemptr.h Remove tabs after spaces in C comments 2014-05-06 11:26:26 -04:00
large_object.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
latch.h Split up process latch initialization for more-fail-soft behavior. 2012-10-14 23:00:07 -04:00
lmgr.h Fix performance problems with autovacuum truncation in busy workloads. 2013-01-23 13:40:06 -06:00
lock.h Remove tabs after spaces in C comments 2014-05-06 11:26:26 -04:00
lwlock.h Efficient transaction-controlled synchronous replication. 2011-03-06 22:49:16 +00:00
off.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
pg_sema.h Remove tabs after spaces in C comments 2014-05-06 11:26:26 -04:00
pg_shmem.h Remove tabs after spaces in C comments 2014-05-06 11:26:26 -04:00
pmsignal.h pgindent run before PG 9.1 beta 1. 2011-04-10 11:42:00 -04:00
pos.h Remove tabs after spaces in C comments 2014-05-06 11:26:26 -04:00
predicate.h Remove pointless const qualifiers from function arguments in the SSI code. 2011-06-22 12:21:34 +03:00
predicate_internals.h Remove tabs after spaces in C comments 2014-05-06 11:26:26 -04:00
proc.h Remove tabs after spaces in C comments 2014-05-06 11:26:26 -04:00
procarray.h Ensure no xid gaps during Hot Standby startup 2013-06-23 14:50:17 +01:00
procsignal.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
reinit.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
relfilenode.h Remove tabs after spaces in C comments 2014-05-06 11:26:26 -04:00
s_lock.h Fix broken #ifdef for __sparcv8 2015-02-13 23:57:28 +02:00
shmem.h Increase SHMEM_INDEX_SIZE from 32 to 64. We're currently at 40 entries in 2011-03-31 13:37:01 +03:00
sinval.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
sinvaladt.h Remove tabs after spaces in C comments 2014-05-06 11:26:26 -04:00
smgr.h Remove tabs after spaces in C comments 2014-05-06 11:26:26 -04:00
spin.h Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
standby.h Don't advance checkPoint.nextXid near the end of a checkpoint sequence. 2012-12-02 15:20:08 -05:00