Recursively fsync() the data directory after a crash.

Robert Haas <rhaas@postgresql.org>

Commit: 30ba0d0c21a825bc9c0565ea331be98068536b0e
Author: Robert Haas <rhaas@postgresql.org>
Date: 2015-05-04T18:04:53Z
Releases: 9.0.20
Recursively fsync() the data directory after a crash.

Otherwise, if there's another crash, some writes from after the first
crash might make it to disk while writes from before the crash fail
to make it to disk.  This could lead to data corruption.

Back-patch to all supported versions.

Abhijit Menon-Sen, reviewed by Andres Freund and slightly revised
by me.

Files

PathChange+/−
src/backend/access/transam/xlog.c modified +41 −0
src/backend/storage/file/fd.c modified +115 −0
src/backend/utils/misc/guc.c modified +1 −1
src/include/storage/fd.h modified +2 −0
src/include/utils/guc.h modified +1 −0