Re: Unlogged rel fake lsn vs GetVictimBuffer() - Mailing list pgsql-hackers

From Melanie Plageman
Subject Re: Unlogged rel fake lsn vs GetVictimBuffer()
Date
Msg-id CAAKRu_a0w7wVZCysJ1s6tEPkdsGyYR4iBSEUefa3Y2nWLx2vSw@mail.gmail.com
Whole thread Raw
In response to Unlogged rel fake lsn vs GetVictimBuffer()  (Andres Freund <andres@anarazel.de>)
Responses Re: Unlogged rel fake lsn vs GetVictimBuffer()
List pgsql-hackers
On Sat, Feb 28, 2026 at 1:09 PM Andres Freund <andres@anarazel.de> wrote:
>
> I think we ought to fix it, even if it is currently harmless. It seems like
> it'd not be too hard for this to go wrong in the future, it'd e.g. make sense
> for XLogNeedsFlush() to XLogCtl->LogwrtRqst.Write and wake up walwriter. Which
> would have bad consequences if it were done with a fake LSN.
>
> I also think it might be good for XLogNeedsFlush() to have an assertion
> verifying that the LSN in the realm of the possible. It's too easy to feed it
> something entirely bogus right now and never notice.

I agree we should fix it. I noticed it while working on write
combining. I wrote the attached patch to clean up. It's more than you
were mentioning doing, but I think it makes the code nicer. You can of
course also add assertions to XLogNeedsFlush() too.

- Melanie

Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: All-visible pages with valid prune xid are confusing
Next
From: Peter Geoghegan
Date:
Subject: Re: index prefetching