aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Geoghegan <pg@bowt.ie>2024-12-23 15:46:00 -0500
committerPeter Geoghegan <pg@bowt.ie>2024-12-23 15:46:00 -0500
commitda9517fb3a0979f8d75823199f7a231e0269963b (patch)
tree005af1e2dec47d60c133fd9098867045da858ad3 /src
parentc431986de16cc7e7af8ba3af45d846f279606fd3 (diff)
downloadpostgresql-da9517fb3a0979f8d75823199f7a231e0269963b.tar.gz
postgresql-da9517fb3a0979f8d75823199f7a231e0269963b.zip
Reset btpo_cycleid in nbtree VACUUM's REDO routine.
Reset btpo_cycleid to 0 in btree_xlog_vacuum for consistency with _bt_delitems_vacuum (the corresponding original execution code). This makes things neater. There might be some performance benefit to being consistent like this. When btvacuumpage doesn't call _bt_delitems_vacuum, it can still proactively reset btpo_cycleid to 0 via a separate hint-like update mechanism (it does so whenever it sees that it isn't already set to 0). And so it's possible that being consistent about resetting btpo_cycleid like this will save work later on, after standby promotion: subsequent VACUUMs won't need to clear btpo_cycleid using the hint-like update mechanism as often as they otherwise would. Author: Peter Geoghegan <pg@bowt.ie> Reviewed-By: Andrey Borodin <x4mmm@yandex-team.ru> Discussion: https://postgr.es/m/CAH2-Wz=+LDFxn9NZyEsCo8ifcyKt6+n-VLyygySEHgMz+oynqw@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/nbtree/nbtxlog.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/backend/access/nbtree/nbtxlog.c b/src/backend/access/nbtree/nbtxlog.c
index 7e91584f1ae..901b5f70be3 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;