Avoid WAL flush checks for unlogged buffers in GetVictimBuffer()

Melanie Plageman <melanieplageman@gmail.com>

Commit: 11e0824bd97e1639f9358260f389083135e0b5e3
Author: Melanie Plageman <melanieplageman@gmail.com>
Date: 2026-03-11T18:50:50Z
Avoid WAL flush checks for unlogged buffers in GetVictimBuffer()

GetVictimBuffer() rejects a victim buffer if it is from a bulkread
strategy ring and reusing it would require flushing WAL. Unlogged table
buffers can have fake LSNs (e.g. unlogged GiST pages) and calling
XLogNeedsFlush() on a fake LSN is meaningless.

This is a bit of future-proofing because currently the bulkread strategy
is not used for relations with fake LSNs.

Author: Melanie Plageman <melanieplageman@gmail.com>
Reported-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Andres Freund <andres@anarazel.de>
Earlier version reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/flat/fmkqmyeyy7bdpvcgkheb6yaqewemkik3ls6aaveyi5ibmvtxnd%40nu2kvy5rq3a6

Files

PathChange+/−
src/backend/storage/buffer/bufmgr.c modified +16 −16

Discussion

Cited messages not in the archive: flat/fmkqmyeyy7bdpvcgkheb6yaqewemkik3ls6aaveyi5ibmvtxnd@nu2kvy5rq3a6