Re: gistGetFakeLSN() can return incorrect LSNs

x4mmm@yandex-team.ru

From: Andrey Borodin <x4mmm@yandex-team.ru>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@postgresql.org, Noah Misch <noah@leadboat.com>, Tomas Vondra <tv@fuzzy.cz>, Peter Geoghegan <pg@bowt.ie>
Date: 2026-03-05T18:26:30Z
Lists: pgsql-hackers
Interesting bug. Your analysis seems correct to me.

> On 5 Mar 2026, at 22:10, Andres Freund <andres@anarazel.de> wrote:
> 
> To be safe, this code would need to use a version of GetXLogInsertRecPtr()
> that does use XLogBytePosToEndRecPtr() instead of XLogBytePosToRecPtr().

Can't we just take Insert->CurrBytePos without XLogBytePosToEndRecPtr()?
Is there a point in alignment before the page header?


Best regards, Andrey Borodin.



Commits

  1. Use GetXLogInsertEndRecPtr in gistGetFakeLSN

  2. Skip WAL for new relfilenodes, under wal_level=minimal.