v35-0002-Add-PageGetPruneXid-helper.patch
text/x-patch
Filename: v35-0002-Add-PageGetPruneXid-helper.patch
Type: text/x-patch
Part: 1
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v35-0002
Subject: Add PageGetPruneXid helper
| File | + | − |
|---|---|---|
| src/backend/access/heap/pruneheap.c | 2 | 2 |
| src/include/storage/bufpage.h | 6 | 0 |
From aad49496321243eaab94d288da021c537b96f652 Mon Sep 17 00:00:00 2001
From: Melanie Plageman <melanieplageman@gmail.com>
Date: Wed, 25 Feb 2026 14:09:11 -0500
Subject: [PATCH v35 02/18] Add PageGetPruneXid helper
This is inline with other page header accessors. It improves readability
and avoids long lines.
---
src/backend/access/heap/pruneheap.c | 4 ++--
src/include/storage/bufpage.h | 6 ++++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c
index 3c5d33834fc..1d61b336193 100644
--- a/src/backend/access/heap/pruneheap.c
+++ b/src/backend/access/heap/pruneheap.c
@@ -234,7 +234,7 @@ heap_page_prune_opt(Relation relation, Buffer buffer)
* determining the appropriate horizon is a waste if there's no prune_xid
* (i.e. no updates/deletes left potentially dead tuples around).
*/
- prune_xid = ((PageHeader) page)->pd_prune_xid;
+ prune_xid = PageGetPruneXid(page);
if (!TransactionIdIsValid(prune_xid))
return;
@@ -868,7 +868,7 @@ heap_page_prune_and_freeze(PruneFreezeParams *params,
* pd_prune_xid field or the page was marked full, we will update the hint
* bit.
*/
- do_hint_prune = ((PageHeader) prstate.page)->pd_prune_xid != prstate.new_prune_xid ||
+ do_hint_prune = PageGetPruneXid(prstate.page) != prstate.new_prune_xid ||
PageIsFull(prstate.page);
/*
diff --git a/src/include/storage/bufpage.h b/src/include/storage/bufpage.h
index ae3725b3b81..92a6bb9b0c0 100644
--- a/src/include/storage/bufpage.h
+++ b/src/include/storage/bufpage.h
@@ -441,6 +441,12 @@ PageClearAllVisible(Page page)
((PageHeader) page)->pd_flags &= ~PD_ALL_VISIBLE;
}
+static inline TransactionId
+PageGetPruneXid(const PageData *page)
+{
+ return ((const PageHeaderData *) page)->pd_prune_xid;
+}
+
/*
* These two require "access/transam.h", so left as macros.
*/
--
2.43.0