agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Melanie Plageman <melanieplageman@gmail.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Introduce macros for WAL block reference IDs of some heap record
Date: Wed, 15 Jul 2026 21:25:51 +0000
Message-ID: <E1wk770-000Lws-1O@gemulon.postgresql.org> (raw)

Introduce macros for WAL block reference IDs of some heap record types

When registering a buffer with the WAL machinery, the caller assigns it a
block reference ID, and replay must read each block back by that same ID.
Today these IDs are bare integers assigned by convention (0, 1, 2, ...),
which is easy to follow when a record registers a single block, or when the
blocks are handled during replay in their registration order.

An upcoming bug fix registers up to two visibility map blocks in addition
to the heap block(s) when clearing the VM, and these are not handled during
replay in a straightforward 1:1, in-registration-order fashion. Relying on
bare integers for the block IDs in that case is error-prone.

Introduce macros naming the block reference IDs for the heap record types
that the upcoming commit extends to register visibility map blocks, so the
registration and replay sites refer to the same block by a meaningful name.

Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/66mqpfyti3qhfttcsv6r2lbvqqd32rrmpn6i47ovrsnvguts46%40gou54xc;
Backpatch through: 17

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/10911fde088aef9c3be511955e9be632964f7a4a

Modified Files
--------------
src/backend/access/heap/heapam.c      | 45 ++++++++++++++++------------
src/backend/access/heap/heapam_xlog.c | 56 ++++++++++++++++++++++-------------
src/include/access/heapam_xlog.h      | 29 +++++++++++++-----
3 files changed, 84 insertions(+), 46 deletions(-)



view thread (4+ messages)  latest in thread

Message-ID: <E1wk770-000Lws-1O@gemulon.postgresql.org>
Permalink:  ../E1wk770-000Lws-1O@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wk770-000Lws-1O@gemulon.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: melanieplageman@gmail.com, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Introduce macros for WAL block reference IDs of some heap record
  In-Reply-To: <E1wk770-000Lws-1O@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox