postgresql/src/include
Tom Lane aa8377e64f 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
..
access Flush unlogged table's buffers when copying or moving databases. 2014-10-20 23:47:00 +02:00
bootstrap Fix off-by-one loop count in MapArrayTypeName, and get rid of static array. 2014-12-16 15:35:43 -05:00
catalog Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
commands Test IsInTransactionChain, not IsTransactionBlock, in vac_update_relstats. 2014-10-30 13:03:31 -04:00
datatype Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
executor Ensure that whole-row Vars produce nonempty column names. 2014-11-10 15:21:26 -05:00
foreign Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
lib Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
libpq Remove code to match IPv4 pg_hba.conf entries to IPv4-in-IPv6 addresses. 2015-02-17 12:49:44 -05:00
mb Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
nodes Ensure that whole-row Vars produce nonempty column names. 2014-11-10 15:21:26 -05:00
optimizer Fix some more problems with nested append relations. 2014-10-01 19:30:34 -04:00
parser Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
port Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
portability Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
postmaster Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
regex Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
replication Make SyncRepWakeQueue to a static function 2015-03-26 10:39:52 +09:00
rewrite Avoid getting more than AccessShareLock when deparsing a query. 2014-03-06 19:31:12 -05:00
snowball Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
storage Fix fsync-at-startup code to not treat errors as fatal. 2015-05-28 17:33:03 -04:00
tcop Be more careful to not lose sync in the FE/BE protocol. 2015-02-02 17:09:35 +02:00
tsearch Predict integer overflow to avoid buffer overruns. 2014-02-17 09:33:33 -05:00
utils Explicitly support the case that a plancache's raw_parse_tree is NULL. 2014-11-12 15:58:47 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
c.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
fmgr.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
funcapi.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
getaddrinfo.h Fix assorted issues in client host name lookup. 2014-04-02 17:11:31 -04:00
getopt_long.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
Makefile Fix server header file installation with vpath builds 2011-11-10 20:52:54 +02:00
miscadmin.h Be more careful to not lose sync in the FE/BE protocol. 2015-02-02 17:09:35 +02:00
pg_config.h.in On Darwin, detect and report a multithreaded postmaster. 2015-01-07 22:41:49 -05:00
pg_config.h.win32 Stamp 9.2.11. 2015-05-18 14:34:28 -04:00
pg_config_manual.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
pg_trace.h Run pgindent on 9.2 source tree in preparation for first 9.3 2012-06-10 15:20:04 -04:00
pgstat.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
pgtime.h Support timezone abbreviations that sometimes change. 2014-10-16 15:22:20 -04:00
port.h Revert error-throwing wrappers for the printf family of functions. 2015-05-19 18:17:42 -04:00
postgres.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
postgres_ext.h Remove tabs after spaces in C comments 2014-05-06 11:26:27 -04:00
postgres_fe.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
rusagestub.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00
windowapi.h Update copyright notices for year 2012. 2012-01-01 18:01:58 -05:00