| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Remove redundant unlink() in KeepFileRestoredFromArchive() for n |
| Date: | 2026-08-05 23:19:40 |
| Message-ID: | E1wrktg-00000000MIT-2yVf@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(at)gmail(dot)com>
Reviewed-by: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Reviewed-by: Neil Chen <carpenter(dot)nail(dot)cz(at)gmail(dot)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(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David Rowley | 2026-08-06 05:43:14 | pgsql: Fix unlikely incremental tuple deform bug with missing attrs |
| Previous Message | Jeff Davis | 2026-08-05 20:26:31 | pgsql: Always check foreign-server USAGE when resolving subscription co |