Remove redundant unlink() in KeepFileRestoredFromArchive() for non-WIN32 KeepFileRestoredFromArchive() called unlink() on an existing WAL segment before durable_rename() replaced it. rename(2) atomically replaces a target on POSIX systems, and the extra unlink() created a small window where it would be possible for a concurrent WAL sender to see a segment as missing.
Note that the window still exists on WIN32, as we lack a safe concurrent alternative. Perhaps something like ReplaceFile() could be looked at for this purpose. This problem is hard to reach in practice, so no backpatch is done. I also tend to be conservative regarding recovery changes, even small, in stable branches. Author: Stepan Neretin <[email protected]> Reviewed-by: Andrey Borodin <[email protected]> Reviewed-by: Neil Chen <[email protected]> Discussion: https://postgr.es/m/CA+Yyo5S0C25jS_pRWQiGgoiy+X=GyJS7ZJkEq=_sw1wwpkl...@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/1200dfd60c367e97a5e1f31100d82072eb0178b6 Modified Files -------------- src/backend/access/transam/xlogarchive.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
