Re: [PATCH 0/2] Parallelizing the archiver

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: Stepan Neretin <slpmcf(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH 0/2] Parallelizing the archiver
Date: 2026-11-23 07:47:31
Message-ID: 3DA5B8BB-028E-4774-A4DE-8DFBEBF584C8@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Stepan,

On November 22, 2026, Stepan Neretin wrote:
> with pgarch feeding file names and getting
> completed or failed files back one by one?

Yes, that is still the direction I'd prefer. I'd like us to consider
the archive/restore interface more broadly than parallel execution of
archive_command.

One missing piece is distinguishing a missing file from a failed
attempt to check or retrieve it. We use restore_command results to
discover timelines. Today, an ordinary command failure followed by a
missing local history file makes existsTimeLineHistory() return false.
An unavailable archive can therefore look like an unused timeline ID.
PostgreSQL needs to distinguish not-found from retryable and
non-retryable errors, rather than infer all of that from success or
failure of a shell command. That is a correctness issue, not a
throughput optimization.

For archiving, I'd like a stream of ready files and independent
per-file acknowledgments, without waiting for a whole batch. Completion
can be out of order. The contract should distinguish a file being
durably archived from merely being queued, and describe retry behavior.
Your submit/poll callbacks look like a useful starting point.

Tools such as WAL-G and pgBackRest already implement parallelism behind
the synchronous API. In WAL-G we predict adjacent .ready names to avoid
directory scans, periodically scan for missed or failed uploads, and
make our own scheduling decisions. PostgreSQL still sees what looks
like a request to push one file. I'd rather give these tools the
information they need than make them reconstruct it from archive_status.

I'd also like PostgreSQL to control archive/restore concurrency limits
and select work, while leaving execution to the tool. For example,
WAL-G prefetch guesses subsequent segment names and can issue useless
requests on the old timeline near a switch. When PostgreSQL already has
the relevant history, it knows where that switch is. Passing the
intended files to the tool would avoid duplicating that knowledge.

I don't suggest implementing all of this in one patch. Could we first
agree on the contract we want the async interface to support, including
a long-lived external process and the restore side, and then build it
incrementally?

Thank you!

Best regards, Andrey Borodin.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-11-23 08:26:34 simplehash: Undefine SH_RAW_ALLOCATOR after inclusion
Previous Message Andrey Borodin 2026-11-23 07:45:48 Re: [PATCH 0/2] Parallelizing the archiver