Re: gistGetFakeLSN() can return incorrect LSNs
Noah Misch <noah@leadboat.com>
From: Noah Misch <noah@leadboat.com>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@postgresql.org, Tomas Vondra <tv@fuzzy.cz>, Peter Geoghegan <pg@bowt.ie>
Date: 2026-03-05T18:52:03Z
Lists: pgsql-hackers
On Thu, Mar 05, 2026 at 12:10:11PM -0500, Andres Freund wrote: > Tomas encountered a crash with the index prefetching patchset. One of the > patches included therein is a generalization of the gistGetFakeLSN() > mechanism, which is then used by other indexes as well. That triggered an > occasional, hard to locally reproduce, ERROR or PANIC in CI, about > > ERROR: xlog flush request 0/01BD2018 is not satisfied --- flushed only to 0/01BD2000 > To be safe, this code would need to use a version of GetXLogInsertRecPtr() > that does use XLogBytePosToEndRecPtr() instead of XLogBytePosToRecPtr(). I agree. Thanks for diagnosing it. Feel free to move forward with that strategy, or let me know if you'd like me to do it. > However, if I put an XLogFlush() into gistGetFakeLSN() and use > wal_level=minimal, it's a lot easier. > > > It looks like this was introduced in > > commit c6b92041d38 > Author: Noah Misch <noah@leadboat.com> > Date: 2020-04-04 12:25:34 -0700 > > Skip WAL for new relfilenodes, under wal_level=minimal. Combining that XLogFlush() with wal_level=minimal (your recipe) does make predicate-gist.spec fail, both at that commit and today.
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