Re: Use WALReadFromBuffers in more places

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
Cc: Kirill Reshke <reshkekirill(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, Jingtang Zhang <mrdrivingduck(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Nitin Jadhav <nitinjadhavpostgres(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: Use WALReadFromBuffers in more places
Date: 2026-11-20 01:49:12
Message-ID: CALj2ACUkcyQy59GueB4+C-ZD81cuUYOCg5nb0mqxhs0imQ-pUA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Wed, Nov 4, 2026 at 1:09 PM Bharath Rupireddy
<bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>
> > Regarding the code, state->seg.ws_tli cannot be updated if logical_read_xlog_page()
> > bypasses the actual WAL read. It seems to break the callback rule determined
> > in xlogheader.h:
>
> Yes, you are right. When the WAL is fully read from the buffers,
> ws_tli stays 0. For the existing physical walsender the first read
> always happens from a WAL file, as we attempt to read from the buffers
> with ws_tli 0. I can't think of any correctness issue, but it affects
> error reporting for file removal and validation checks. When reading
> from the buffers, the validation checks rarely fail, because the WAL
> pages are initialized atomically for next use.
>
> I would like to fix this by setting seg.ws_tli when we skip reading
> from the file.

Please find the attached v11 patches with the above change.

--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v11-0001-Use-WALReadFromBuffers-for-logical-walsenders.patch application/octet-stream 4.2 KB
v11-0002-Use-WALReadFromBuffers-for-local-WAL-reads.patch application/octet-stream 3.6 KB
v11-0003-Use-WALReadFromBuffers-for-WAL-summarizer.patch application/octet-stream 3.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2026-11-20 01:54:50 Re: A bug in recovery prefetcher, triggering asserts / FATAL: checkpoint request failed
Previous Message Fujii Masao 2026-11-20 01:21:25 Re: [PATCH] Add planner support function to two-argument regexp_like()