Re: Fix archive restore race that could unlink WAL before rename

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, Neil Chen <carpenter(dot)nail(dot)cz(at)gmail(dot)com>, Stepan Neretin <slpmcf(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Fix archive restore race that could unlink WAL before rename
Date: 2026-08-06 02:08:32
Message-ID: anPsoD44welHd82R@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 06, 2026 at 10:43:21AM +0900, Fujii Masao wrote:
> This isn't directly related to this commit, but while reading the modified code
> I found a small pre-existing issue in the WIN32 path.
>
> In KeepFileRestoredFromArchive(), if unlink(oldpath) fails, the error message
> reports xlogfpath, even though the file being removed is actually oldpath:
>
> if (unlink(oldpath) != 0)
> ereport(FATAL,
> (errcode_for_file_access(),
> errmsg("could not remove file \"%s\": %m",
> xlogfpath)));
>
> Should we fix that as well?

Eh. Yes, that should be adjusted. Perhaps you would like to do so
yourself. I don't really think it's worth bothering beyond HEAD. If
you think differently, of course feel free.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Xuneng Zhou 2026-08-06 02:10:01 Re: BUG: ReadStream look-ahead exhausts local buffers when effective_io_concurrency>=64
Previous Message Michael Paquier 2026-08-06 02:06:29 Re: Split index and table statistics into different types of stats