postgresql/src/backend
Andres Freund 1d4a0ab19a Avoid unlikely data-loss scenarios due to rename() without fsync.
Renaming a file using rename(2) is not guaranteed to be durable in face
of crashes. Use the previously added durable_rename()/durable_link_or_rename()
in various places where we previously just renamed files.

Most of the changed call sites are arguably not critical, but it seems
better to err on the side of too much durability.  The most prominent
known case where the previously missing fsyncs could cause data loss is
crashes at the end of a checkpoint. After the actual checkpoint has been
performed, old WAL files are recycled. When they're filled, their
contents are fdatasynced, but we did not fsync the containing
directory. An OS/hardware crash in an unfortunate moment could then end
up leaving that file with its old name, but new content; WAL replay
would thus not replay it.

Reported-By: Tomas Vondra
Author: Michael Paquier, Tomas Vondra, Andres Freund
Discussion: 56583BDD.9060302@2ndquadrant.com
Backpatch: All supported branches
2016-03-09 18:53:53 -08:00
..
access Avoid unlikely data-loss scenarios due to rename() without fsync. 2016-03-09 18:53:53 -08:00
bootstrap Fix typos in comments and doc 2016-01-28 16:47:36 +09:00
catalog Change the format of the VM fork to add a second bit per page. 2016-03-01 21:49:41 -05:00
commands Re-pgindent vacuumlazy.c. 2016-03-09 13:51:11 -05:00
executor Make the upper part of the planner work by generating and comparing Paths. 2016-03-07 15:58:22 -05:00
foreign Remove parallel-safety check from GetExistingLocalJoinPath. 2016-02-05 08:07:38 -05:00
lib Add two HyperLogLog functions 2016-01-19 17:40:15 -03:00
libpq Properly close token in sspi authentication 2016-01-14 13:06:03 +01:00
main Update copyright for 2016 2016-01-02 13:33:40 -05:00
nodes Improve handling of group-column indexes in GroupingSetsPath. 2016-03-08 22:32:11 -05:00
optimizer Fix incorrect tlist generation in create_gather_plan(). 2016-03-09 10:56:46 -05:00
parser Fix copy-and-pasteo in comment. 2016-03-09 10:29:14 -05:00
po Translation updates 2015-06-28 23:56:55 -04:00
port Windows: Make pg_ctl reliably detect service status 2016-01-07 11:59:08 -03:00
postmaster Avoid unlikely data-loss scenarios due to rename() without fsync. 2016-03-09 18:53:53 -08:00
regex Suppress compiler warnings about useless comparison of unsigned to zero. 2016-02-15 17:12:16 -05:00
replication Avoid unlikely data-loss scenarios due to rename() without fsync. 2016-03-09 18:53:53 -08:00
rewrite Improve error message for rejecting RETURNING clauses with dropped columns. 2016-02-29 19:11:38 -05:00
snowball Update copyright for 2016 2016-01-02 13:33:40 -05:00
storage Introduce durable_rename() and durable_link_or_rename(). 2016-03-09 18:53:53 -08:00
tcop Enable parallelism for prepared statements and extended query protocol. 2016-02-25 13:02:18 +05:30
tsearch Fix uninstall target in tsearch Makefile 2016-03-07 20:36:59 -05:00
utils Avoid unlikely data-loss scenarios due to rename() without fsync. 2016-03-09 18:53:53 -08:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove maintainer-check target, fold into normal build 2013-10-10 20:11:56 -04:00
Makefile Add support for systemd service notifications 2016-02-02 21:04:29 -05:00
nls.mk Remove trailing slashes from directories in find command 2015-09-18 22:06:54 -04:00