Re: Be strict when request to flush past end of WAL in WaitXLogInsertionsToFinish

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: surya poondla <suryapoondla4(at)gmail(dot)com>
Cc: Paul Kim <mok03127(at)gmail(dot)com>, pgsql-hackers mailing list <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Subject: Re: Be strict when request to flush past end of WAL in WaitXLogInsertionsToFinish
Date: 2026-11-15 12:27:44
Message-ID: 66DFB00A-6BDA-4A02-98FF-66E36661C61B@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

Interesting bug!

The end-position calculation in v8 looks correct to me.

The end of the switch record is already computed in
ReserveXLogSwitch(), before the reservation is extended to the segment
boundary. Could we keep that value rather than reconstruct it later?

PFA an alternative based on v8, with the existing test included. It
separates EndPos from ReservedEndPos. That needs a little more
refactoring, but each variable keeps one meaning throughout
XLogInsertRecord(), which I find easier to follow. WDYT?
It's only an idea on how to do less bugs in future, I'm not wedded to
this refactoring.

Perhaps, for backpatching, v8 is preferable because the change is smaller.

Thank you!

Best regards, Andrey Borodin.

Attachment Content-Type Size
v9-0001-Keep-WAL-switch-record-and-reservation-ends-distinct.patch application/octet-stream 11.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexandre Felipe 2026-11-15 12:32:17 Re: pg_regress: schedule multi-line test groups
Previous Message Andreas Karlsson 2026-11-15 12:27:35 Re: pg_threads.h take II