agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove redundant unlink() in KeepFileRestoredFromArchive() for n
Date: Wed, 05 Aug 2026 23:19:40 +0000
Message-ID: <E1wrktg-00000000MIT-2yVf@gemulon.postgresql.org> (raw)
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 <slpmcf@gmail.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Neil Chen <carpenter.nail.cz@gmail.com>
Discussion: https://postgr.es/m/CA+Yyo5S0C25jS_pRWQiGgoiy+X=GyJS7ZJkEq=_SW1WWpkL3Sg@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(-)
Message-ID: <E1wrktg-00000000MIT-2yVf@gemulon.postgresql.org>
Permalink: ../E1wrktg-00000000MIT-2yVf@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1wrktg-00000000MIT-2yVf@gemulon.postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Remove redundant unlink() in KeepFileRestoredFromArchive() for n
In-Reply-To: <E1wrktg-00000000MIT-2yVf@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox