From 8af186ee9dd8c7dc20f37a69b34cab7b95faa43b Mon Sep 17 00:00:00 2001
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: Wed, 20 Mar 2024 14:03:06 +0200
Subject: [PATCH v5 07/26] Add comment to log_heap_prune_and_freeze().

XXX: This should be rewritten, but I tried to at least list some
important points.
---
 src/backend/access/heap/pruneheap.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c
index 6482d9d05c1..cd86a6262f5 100644
--- a/src/backend/access/heap/pruneheap.c
+++ b/src/backend/access/heap/pruneheap.c
@@ -1274,6 +1274,25 @@ heap_log_freeze_plan(HeapTupleFreeze *tuples, int ntuples,
 	return nplans;
 }
 
+/*
+ * Write a XLOG_HEAP2_PRUNE_FREEZE WAL record
+ *
+ * This is used for several different page maintenance operations:
+ *
+ * Page pruning: some items are redirected, some marked dead, some removed altogether
+ *
+ * Freezing: only 'frozen' is used
+ *
+ * Vacuum, 2nd pass: only 'unused' is used, and lp_truncate_only is set to true.
+ *
+ * They have enough commonalities that we use a single WAL record for them
+ * all.
+ *
+ * Note: This function scribbles on the 'frozen' array.
+ *
+ * The caller must hold an appropriate lock on 'buffer'.
+ * Note: This is called in a critical section, so careful what you do here.
+ */
 void
 log_heap_prune_and_freeze(Relation relation, Buffer buffer,
 						  TransactionId conflict_xid,
-- 
2.39.2

