Re: Unlogged rel fake lsn vs GetVictimBuffer()

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Peter Geoghegan <pg(at)bowt(dot)ie>
Subject: Re: Unlogged rel fake lsn vs GetVictimBuffer()
Date: 2026-02-28 18:58:48
Message-ID: CAAKRu_a0w7wVZCysJ1s6tEPkdsGyYR4iBSEUefa3Y2nWLx2vSw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Feb 28, 2026 at 1:09 PM Andres Freund <andres(at)anarazel(dot)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 Content-Type Size
buffer-rejection.patch text/x-patch 5.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2026-02-28 19:16:22 Re: index prefetching
Previous Message Andres Freund 2026-02-28 18:55:50 Re: All-visible pages with valid prune xid are confusing