Assert correct VM page passed to pruning Before pruning a heap page, we get the current status of the corresponding VM page. If the passed in vmbuffer isn't the right one, visibilitymap_get_status() will silently unpin it and pin the correct page. Pruning assumes the caller manages the vmbuffer lifecycle, so this would leave the caller with a stale VM reference and would leak the new VM pin. To avoid mistakes in development, assert that the correct VM page is pinned before beginning.
Reported-by: Melanie Plageman <[email protected]> Reviewed-by: Andrey Borodin <[email protected]> Discussion: https://postgr.es/m/CAAKRu_amj7qLF4c=9ijd=708Fu2G8gg-2EqwBu=acdahu2s...@mail.gmail.com Backpatch-through: 19 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/40cc0662ed7c0bf07e8c6534b1291ec5bcb5fee0 Modified Files -------------- src/backend/access/heap/pruneheap.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
