Re: strange perf regression with data checksums
Peter Geoghegan <pg@bowt.ie>
From: Peter Geoghegan <pg@bowt.ie>
To: Andres Freund <andres@anarazel.de>
Cc: Tomas Vondra <tomas@vondra.me>,
Aleksander Alekseev <aleksander@timescale.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-05-21T21:11:56Z
Lists: pgsql-hackers
On Wed, May 21, 2025 at 12:29 PM Andres Freund <andres@anarazel.de> wrote: > > The relevant nbtree code seems more elegant if we avoid calling > > BufferGetLSNAtomic() unless and until its return value might actually > > be useful. It's quite a lot easier to understand the true purpose of > > so->currPos.lsn with this new structure. > > I'm not against that - ISTM we should do both. Agreed. Long term, we should move all of this stuff out of index AMs, which don't have any good reason for doing their own thing. In a sense, the known bugs in GiST and SP-GiST index-only scans (the "must not drop the index page pin during index-only scans to avoid unsafe concurrent TID recycling" bugs) exist because those index AMs couldn't just opt in to some generic scheme, used by all index AMs that support amgettuple-based scans. Technically, the LSN is only needed to make kill_prior_tuple LP_DEAD bit setting safe when the page pin is dropped. But it still seems related to those GiST + SP-GiST IOS bugs, since we also need to consider when dropping the pin is categorically unsafe (only nbtree gets that aspect right currently). -- Peter Geoghegan
Commits
-
Make _bt_killitems drop pins it acquired itself.
- 7c319f54917f 18.0 landed
- 40aa5ddea1c0 17.6 landed
- c7f25feb3862 16.10 landed
- d2ec671092a1 15.14 landed
- 7c7c0a77dc8a 14.19 landed
- 38c8d298704c 13.22 landed
-
Avoid BufferGetLSNAtomic() calls during nbtree scans.
- e6eed40e4441 18.0 landed
-
Reduce pinning and buffer content locking for btree scans.
- 2ed5b87f96d4 9.5.0 cited