Re: Incorrect checksum in control file with pg_rewind test

Maksim.Melnikov <m.melnikov@postgrespro.ru>

From: "Maksim.Melnikov" <m.melnikov@postgrespro.ru>
To: Alexander Korotkov <aekorotkov@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2026-05-12T08:30:55Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Try to handle torn reads of pg_control in frontend.

On 4/21/26 15:12, Alexander Korotkov wrote:
> Thank you for spotting this issue and proposing a patch.  The fork
> builds don't have this problem, because fork replicated contents of
> LocalControlFile to the new process.  And the postmaster has
> consistent snapshot of control file as there is no concurrent process
> which could write it and that moment.  But EXEC_BACKEND, even with
> your patch, may end up different processes with different contents of
> LocalControlFile.  I don't see it could cause a material bug right
> now, but I see this as undesirable divergence between fork and
> EXEC_BACKEND behaviors.  I propose an alternative approach copy the
> contents of control file to the new process via BackendParameters.
> This approach solves two problems at once: no torn reads, and no
> divergence between fork and EXEC_BACKEND.

Hi, Alexander!

Thanks for response! Your patch LGTM.

Best regards,
Maksim Melnikov