public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Geoghegan <[email protected]>
To: PostgreSQL Hackers <[email protected]>
Subject: nbtree VACUUM's REDO routine doesn't clear page's VACUUM cycle ID
Date: Fri, 15 Nov 2024 11:33:37 -0500
Message-ID: <CAH2-Wz=+LDFxn9NZyEsCo8ifcyKt6+n-VLyygySEHgMz+oynqw@mail.gmail.com> (raw)

Attached patch teaches btree_xlog_vacuum, nbtree VACUUM's REDO
routine, to reset the target page's opaque->btpo_cycleid to 0. This
makes the REDO routine match original execution, which seems like a
good idea on consistency grounds.

I propose this for the master branch only.
-- 
Peter Geoghegan


Attachments:

  [application/octet-stream] v1-0001-Clear-btpo_cycleid-in-btree_xlog_vacuum.patch (1.4K, ../CAH2-Wz=+LDFxn9NZyEsCo8ifcyKt6+n-VLyygySEHgMz+oynqw@mail.gmail.com/2-v1-0001-Clear-btpo_cycleid-in-btree_xlog_vacuum.patch)
  download | inline diff:
From d50df1e0cc72298ebe66e8a811ff525a6d09d2f9 Mon Sep 17 00:00:00 2001
From: Peter Geoghegan <[email protected]>
Date: Fri, 15 Nov 2024 11:26:59 -0500
Subject: [PATCH v1] Clear btpo_cycleid in btree_xlog_vacuum

---
 src/backend/access/nbtree/nbtxlog.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/backend/access/nbtree/nbtxlog.c b/src/backend/access/nbtree/nbtxlog.c
index 7e91584f1..901b5f70b 100644
--- a/src/backend/access/nbtree/nbtxlog.c
+++ b/src/backend/access/nbtree/nbtxlog.c
@@ -634,10 +634,11 @@ btree_xlog_vacuum(XLogReaderState *record)
 			PageIndexMultiDelete(page, (OffsetNumber *) ptr, xlrec->ndeleted);
 
 		/*
-		 * Mark the page as not containing any LP_DEAD items --- see comments
-		 * in _bt_delitems_vacuum().
+		 * Clear the vacuum cycle ID, and mark the page as not containing any
+		 * LP_DEAD items
 		 */
 		opaque = BTPageGetOpaque(page);
+		opaque->btpo_cycleid = 0;
 		opaque->btpo_flags &= ~BTP_HAS_GARBAGE;
 
 		PageSetLSN(page, lsn);
@@ -698,7 +699,10 @@ btree_xlog_delete(XLogReaderState *record)
 		if (xlrec->ndeleted > 0)
 			PageIndexMultiDelete(page, (OffsetNumber *) ptr, xlrec->ndeleted);
 
-		/* Mark the page as not containing any LP_DEAD items */
+		/*
+		 * Do *not* clear the vacuum cycle ID, but do mark the page as not
+		 * containing any LP_DEAD items
+		 */
 		opaque = BTPageGetOpaque(page);
 		opaque->btpo_flags &= ~BTP_HAS_GARBAGE;
 
-- 
2.45.2



view thread (2+ messages)

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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: nbtree VACUUM's REDO routine doesn't clear page's VACUUM cycle ID
  In-Reply-To: <CAH2-Wz=+LDFxn9NZyEsCo8ifcyKt6+n-VLyygySEHgMz+oynqw@mail.gmail.com>

* 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