Re: 028_pitr_timelines.pl might fail when cp interrupted and backup includes required segment

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: Stepan Filippov <stepan(dot)filippov(at)yandex(dot)ru>
Cc: pgsql-hackers mailing list <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: 028_pitr_timelines.pl might fail when cp interrupted and backup includes required segment
Date: 2026-08-31 11:30:17
Message-ID: 20C5BD13-BA81-4DDA-9BDF-753916E3B43A@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Stepan,

On Mon, Aug 31, 2026 at 10:21 AM Stepan Filippov wrote:
> In general case we use $$ to add pid to temp_path, whereas on windows
> we do not use this. I believe, this can cause name collision, which is
> not great.
>
> In documentation we do not specify that archive command needs to be
> atomic. Furthermore, we use actual cp as an example. This can lead to
> similar problems not only in tests.

Thank you for the review. Both points make sense.

In v2, both platforms use the test process PID and the node port. The
PID distinguishes parallel tests, and the port distinguishes nodes in
one test. There is only one archiver per node, so retries can safely
reuse the same temporary path.

I also documented that archive commands with concurrent readers should
publish complete files atomically, and warned that the simple cp example
does not. I did not present the helper's mv -f as a production recipe,
because that would contradict the existing requirement not to overwrite
a different pre-existing segment.

There is a trade-off: every archive command now performs an additional
rename. I expect the same-directory rename to be a less frequent source
of failures than partial files from an interrupted copy, but only
buildfarm experience can confirm that we have not replaced a rare failure
mode with a more frequent one.

PFA v2.

Thank you!

Best regards, Andrey Borodin.

Attachment Content-Type Size
v2-0001-Make-test-WAL-archiving-publish-files-atomically.patch application/octet-stream 4.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavlo Golub 2026-08-31 11:35:28 Re: [PATCH v4] Add pg_current_vxact_id() function
Previous Message Chao Li 2026-08-31 11:28:11 Re: Report relation extension blockers within parallel lock groups