pgsql: Remove unneeded VM pin from VM replay

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Remove unneeded VM pin from VM replay
Date: 2025-09-08 14:29:53
Message-ID: E1uvcsT-0017uG-2U@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Remove unneeded VM pin from VM replay

Previously, heap_xlog_visible() called visibilitymap_pin() even after
getting a buffer from XLogReadBufferForRedoExtended() -- which returns a
pinned buffer containing the specified block of the visibility map.

This would just have resulted in visibilitymap_pin() returning early
since the specified page was already present and pinned, but it was
confusing extraneous code, so remove it. It doesn't seem worth
backporting, though.

It appears to be an oversight in 2c03216.

While we are at it, remove two VM-related redundant asserts in the COPY
FREEZE code path. visibilitymap_set() already asserts that
PD_ALL_VISIBLE is set on the heap page and checks that the vmbuffer
contains the bits corresponding to the specified heap block, so callers
do not also need to check this.

Author: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Reported-by: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Reported-by: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Reviewed-by: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>

Discussion: https://postgr.es/m/CALdSSPhu7WZd%2BEfQDha1nz%3DDC93OtY1%3DUFEdWwSZsASka_2eRQ%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3399c265543ec3cdbeff2fa2900e03b326705f63

Modified Files
--------------
src/backend/access/heap/heapam.c | 3 ---
src/backend/access/heap/heapam_xlog.c | 1 -
2 files changed, 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2025-09-08 15:57:15 pgsql: Don't generate fake "*SELECT*" or "*SELECT* %d" subquery aliases
Previous Message Amit Kapila 2025-09-08 12:06:49 pgsql: Add test to prevent premature removal of conflict-relevant data.