This is an automated email from the ASF dual-hosted git repository.

chenjinbao1989 pushed a commit to branch cbdb-postgres-merge
in repository https://gitbox.apache.org/repos/asf/cloudberry.git


The following commit(s) were added to refs/heads/cbdb-postgres-merge by this 
push:
     new 6a55bea1af4 Use new xlog type in heap_freeze_tuple_wal_logged
6a55bea1af4 is described below

commit 6a55bea1af4b015d4a61887bfce4af2c3dc84e1a
Author: Jinbao Chen <[email protected]>
AuthorDate: Wed Dec 17 01:46:47 2025 +0800

    Use new xlog type in heap_freeze_tuple_wal_logged
---
 src/backend/access/bitmap/bitmapattutil.c |  2 +-
 src/backend/access/heap/heapam.c          | 18 +++++++++++++-----
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/backend/access/bitmap/bitmapattutil.c 
b/src/backend/access/bitmap/bitmapattutil.c
index 23a08d0ab40..0cf7e63660c 100644
--- a/src/backend/access/bitmap/bitmapattutil.c
+++ b/src/backend/access/bitmap/bitmapattutil.c
@@ -348,7 +348,7 @@ _bitmap_insert_lov(Relation lovHeap, Relation lovIndex, 
Datum *datum,
        memcpy(indexDatum, datum, (tupDesc->natts - 2) * sizeof(Datum));
        memcpy(indexNulls, nulls, (tupDesc->natts - 2) * sizeof(bool));
        result = index_insert(lovIndex, indexDatum, indexNulls,
-                                                 &(tuple->t_self), lovHeap, 
true, false, NULL);
+                                                 &(tuple->t_self), lovHeap, 
UNIQUE_CHECK_YES, false, NULL);
 
 #ifdef FAULT_INJECTOR
        FaultInjector_InjectFaultIfSet(
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 3e7fa5fd19e..b529891f5f4 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -7584,15 +7584,21 @@ heap_freeze_tuple_wal_logged(Relation rel, HeapTuple 
tup)
        /* WAL logging */
        if (RelationNeedsWAL(rel))
        {
-               XLogRecPtr              recptr;
+               xl_heap_freeze_plan plans[MaxHeapTuplesPerPage];
+               OffsetNumber offsets[MaxHeapTuplesPerPage];
+               int                     nplans;
                xl_heap_freeze_page xlrec;
+               XLogRecPtr      recptr;
 
                /* Caller should not call me on a non-WAL-logged relation */
                Assert(RelationNeedsWAL(rel));
 
+               /* Prepare deduplicated representation for use in WAL record */
+               nplans = heap_log_freeze_plan(&frozen, 1, plans, offsets);
+
                xlrec.snapshotConflictHorizon = InvalidTransactionId;
-               xlrec.nplans = 1;
-               xlrec.isCatalogRel = (RelationGetRelid(rel) < 
FirstNormalObjectId);
+               xlrec.nplans = nplans;
+               xlrec.isCatalogRel = RelationIsAccessibleInLogicalDecoding(rel);
 
                XLogBeginInsert();
                XLogRegisterData((char *) &xlrec, SizeOfHeapFreezePage);
@@ -7603,8 +7609,10 @@ heap_freeze_tuple_wal_logged(Relation rel, HeapTuple tup)
                 * not be stored too.
                 */
                XLogRegisterBuffer(0, buffer, REGBUF_STANDARD);
-               XLogRegisterBufData(0, (char *) &frozen,
-                                                       
sizeof(HeapTupleFreeze));
+               XLogRegisterBufData(0, (char *) plans,
+                                                       nplans * 
sizeof(xl_heap_freeze_plan));
+               XLogRegisterBufData(0, (char *) offsets,
+                                                       1 * 
sizeof(OffsetNumber));
 
                recptr = XLogInsert(RM_HEAP2_ID, XLOG_HEAP2_FREEZE_PAGE);
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to