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-06T05:34:26Z
Lists: pgsql-hackers
> On 6 Mar 2026, at 00:27, Andres Freund <andres@anarazel.de> wrote: > > No, that'd be a completely bogus LSN, as CurrBytePos does not include any > space for page headers, to make the the very contended spinlock'ed section in > ReserveXLogInsertLocation() cheaper Thanks! Now I see it's documented that "usable bytes position" is not XLogRecPtr at all. And XLogBytePosToEndRecPtr() is unavoidable for newly created relations in wal_level=minimal. Perhaps we can even add an Assert that PageSetLSN() does not stamp LSNs from future. Sorry for raising off-topic questions, I'll go check this myself. Best regards, Andrey Borodin.
Commits
-
Use GetXLogInsertEndRecPtr in gistGetFakeLSN
- c0ffc725f8b3 14.23 landed
- ce06b5740ef9 15.18 landed
- 4f4025eac0b9 16.14 landed
- 6ef36bb35884 17.10 landed
- 5b3f63a1bf59 18.4 landed
- b1f14c967202 19 (unreleased) landed
-
Skip WAL for new relfilenodes, under wal_level=minimal.
- c6b92041d385 13.0 cited