0001-amcheck-In-verify_heapam-allows-tuples-with-xmin-0.patch

application/octet-stream

Filename: 0001-amcheck-In-verify_heapam-allows-tuples-with-xmin-0.patch
Type: application/octet-stream
Part: 0
Message: Re: pgsql: amcheck: Fix verify_heapam for tuples where xmin or xmax is 0.

Patch

Format: format-patch
Series: patch 0001
Subject: amcheck: In verify_heapam, allows tuples with xmin 0.
File+
contrib/amcheck/verify_heapam.c 1 2
From 199b1468a67bdbe6e8493339fc78f5bd1d406241 Mon Sep 17 00:00:00 2001
From: Robert Haas <rhaas@postgresql.org>
Date: Mon, 27 Mar 2023 14:36:03 -0400
Subject: [PATCH] amcheck: In verify_heapam, allows tuples with xmin 0.

Commit e88754a1965c0f40a723e6e46d670cacda9e19bd caused that case
to be reported as corruption, but Peter Geoghegan pointed out that
it can legitimately happen in the case of a speculative insertion
that aborts, so we'd better not flag it as corruption after all.
---
 contrib/amcheck/verify_heapam.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/contrib/amcheck/verify_heapam.c b/contrib/amcheck/verify_heapam.c
index ce3114f4e6..f50ee9d29f 100644
--- a/contrib/amcheck/verify_heapam.c
+++ b/contrib/amcheck/verify_heapam.c
@@ -1032,8 +1032,7 @@ check_tuple_visibility(HeapCheckContext *ctx, bool *xmin_commit_status_ok,
 	switch (get_xid_status(xmin, ctx, &xmin_status))
 	{
 		case XID_INVALID:
-			report_corruption(ctx,
-							  pstrdup("xmin is invalid"));
+			/* Could be the result of a speculative insertion that aborted. */
 			return false;
 		case XID_BOUNDS_OK:
 			*xmin_commit_status_ok = true;
-- 
2.37.1 (Apple Git-137.1)