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 ccb62a9408f Fix compile errors for heap
ccb62a9408f is described below

commit ccb62a9408f012518381aae0066eeede66743148
Author: Jinbao Chen <[email protected]>
AuthorDate: Tue Sep 30 20:15:26 2025 +0800

    Fix compile errors for heap
---
 src/backend/access/heap/heapam.c     | 41 +++++++++++++++++++++++++++---------
 src/backend/access/heap/vacuumlazy.c | 30 ++------------------------
 src/include/replication/logical.h    |  2 --
 3 files changed, 33 insertions(+), 40 deletions(-)

diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 883936f481e..71a6f6c5aae 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -846,7 +846,8 @@ continue_page:
                        tuple->t_len = ItemIdGetLength(lpp);
                        ItemPointerSet(&(tuple->t_self), block, lineoff);
 
-                       visible = HeapTupleSatisfiesVisibility(tuple,
+                       visible = 
HeapTupleSatisfiesVisibility(scan->rs_base.rs_rd,
+                                                                               
                   tuple,
                                                                                
                   scan->rs_base.rs_snapshot,
                                                                                
                   scan->rs_cbuf);
 
@@ -2730,7 +2731,6 @@ l1:
        tp.t_len = ItemIdGetLength(lp);
        tp.t_self = *tid;
 
-l1:
        result = HeapTupleSatisfiesUpdate(relation, &tp, cid, buffer);
 
        if (result == TM_Invisible)
@@ -2876,7 +2876,7 @@ l1:
        if (crosscheck != InvalidSnapshot && result == TM_Ok)
        {
                /* Perform additional check for transaction-snapshot mode RI 
updates */
-               if (!HeapTupleSatisfiesVisibility(&tp, crosscheck, buffer))
+               if (!HeapTupleSatisfiesVisibility(relation, &tp, crosscheck, 
buffer))
                        result = TM_Updated;
        }
 
@@ -3144,7 +3144,7 @@ simple_heap_delete(Relation relation, ItemPointer tid)
  * only for TM_SelfModified, since we cannot obtain cmax from a combo CID
  * generated by another transaction).
  */
-static TM_Result
+TM_Result
 heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
                        CommandId cid, Snapshot crosscheck, bool wait,
                        TM_FailureData *tmfd, LockTupleMode *lockmode,
@@ -3574,7 +3574,7 @@ l2:
        if (crosscheck != InvalidSnapshot && result == TM_Ok)
        {
                /* Perform additional check for transaction-snapshot mode RI 
updates */
-               if (!HeapTupleSatisfiesVisibility(&oldtup, crosscheck, buffer))
+               if (!HeapTupleSatisfiesVisibility(relation, &oldtup, 
crosscheck, buffer))
                        result = TM_Updated;
        }
 
@@ -4087,7 +4087,7 @@ l2:
        if (have_tuple_lock)
                UnlockTupleTuplock(relation, &(oldtup.t_self), *lockmode);
 
-       pgstat_count_heap_update(relation, false);
+       pgstat_count_heap_update(relation, false, false);
 
        /*
         * If heaptup is a private copy, release it.  Don't forget to copy 
t_self
@@ -6288,7 +6288,7 @@ heap_inplace_lock(Relation relation,
         * - don't try to continue even if the updater aborts: likewise
         * - no crosscheck
         */
-       result = HeapTupleSatisfiesUpdate(&oldtup, GetCurrentCommandId(false),
+       result = HeapTupleSatisfiesUpdate(relation, &oldtup, 
GetCurrentCommandId(false),
                                                                          
buffer);
 
        if (result == TM_Invisible)
@@ -7567,7 +7567,7 @@ heap_freeze_tuple(HeapTupleHeader tuple,
 void
 heap_freeze_tuple_wal_logged(Relation rel, HeapTuple tup)
 {
-       xl_heap_freeze_tuple    frozen = {0};
+       HeapTupleFreeze         frozen = {0};
        Buffer                  buffer;
        Page                    page;
        HeapTupleHeader         htup;
@@ -7604,9 +7604,29 @@ heap_freeze_tuple_wal_logged(Relation rel, HeapTuple tup)
        if (RelationNeedsWAL(rel))
        {
                XLogRecPtr              recptr;
+               xl_heap_freeze_page xlrec;
+
+               /* Caller should not call me on a non-WAL-logged relation */
+               Assert(RelationNeedsWAL(rel));
+
+               xlrec.snapshotConflictHorizon = InvalidTransactionId;
+               xlrec.nplans = 1;
+               xlrec.isCatalogRel = (RelationGetRelid(rel) < 
FirstNormalObjectId);
+
+               XLogBeginInsert();
+               XLogRegisterData((char *) &xlrec, SizeOfHeapFreezePage);
+
+               /*
+                * The freeze plan array is not actually in the buffer, but 
pretend that
+                * it is.  When XLogInsert stores the whole buffer, the freeze 
plan need
+                * not be stored too.
+                */
+               XLogRegisterBuffer(0, buffer, REGBUF_STANDARD);
+               XLogRegisterBufData(0, (char *) &frozen,
+                                                       
sizeof(HeapTupleFreeze));
+
+               recptr = XLogInsert(RM_HEAP2_ID, XLOG_HEAP2_FREEZE_PAGE);
 
-               recptr = log_heap_freeze(rel, buffer, InvalidTransactionId /* 
cutoff_xid */,
-                                                                       
&frozen, 1 /*ntuples*/);
                PageSetLSN(page, recptr);
        }
 
@@ -9720,6 +9740,7 @@ heap_xlog_freeze_page(XLogReaderState *record)
 {
        XLogRecPtr      lsn = record->EndRecPtr;
        xl_heap_freeze_page *xlrec = (xl_heap_freeze_page *) 
XLogRecGetData(record);
+       TransactionId cutoff_xid = xlrec->snapshotConflictHorizon;
        Buffer          buffer;
 
        /*
diff --git a/src/backend/access/heap/vacuumlazy.c 
b/src/backend/access/heap/vacuumlazy.c
index f32a8bfd743..e3261b49a6c 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -298,15 +298,11 @@ static int        
compute_parallel_vacuum_workers(LVRelState *vacrel,
                                                                                
        int nrequested,
                                                                                
        bool *will_parallel_vacuum);
 #endif
-static void update_index_statistics(LVRelState *vacrel);
 #if 0
 static LVParallelState *begin_parallel_vacuum(LVRelState *vacrel,
                                                                                
          BlockNumber nblocks,
                                                                                
          int nrequested);
 #endif
-static void end_parallel_vacuum(LVRelState *vacrel);
-static LVSharedIndStats *parallel_stats_for_idx(LVShared *lvshared, int 
getidx);
-static bool parallel_processing_is_safe(Relation indrel, LVShared *lvshared);
 static void update_relstats_all_indexes(LVRelState *vacrel);
 static void vacuum_error_callback(void *arg);
 static void update_vacuum_error_info(LVRelState *vacrel,
@@ -363,31 +359,9 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
                }
        }
 
-       if (params->options & VACOPT_VERBOSE)
-               elevel = INFO;
-       else
-               elevel = DEBUG2;
-
-       if (Gp_role == GP_ROLE_DISPATCH)
-               elevel = DEBUG2; /* vacuum and analyze messages aren't 
interesting from the QD */
-
        pgstat_progress_start_command(PROGRESS_COMMAND_VACUUM,
                                                                  
RelationGetRelid(rel));
 
-       /*
-        * MPP-23647.  Update xid limits for heap as well as appendonly
-        * relations.  This allows setting relfrozenxid to correct value
-        * for an appendonly (AO/CO) table.
-        */
-
-       vacuum_set_xid_limits(rel,
-                                                 params->freeze_min_age,
-                                                 params->freeze_table_age,
-                                                 
params->multixact_freeze_min_age,
-                                                 
params->multixact_freeze_table_age,
-                                                 &OldestXmin, &FreezeLimit, 
&xidFullScanLimit,
-                                                 &MultiXactCutoff, 
&mxactFullScanLimit);
-
        /*
         * Setup error traceback support for ereport() first.  The idea is to 
set
         * up an error context callback to display additional information on any
@@ -629,7 +603,7 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
        vac_update_relstats(rel, new_rel_pages, vacrel->new_live_tuples,
                                                new_rel_allvisible, 
vacrel->nindexes > 0,
                                                vacrel->NewRelfrozenXid, 
vacrel->NewRelminMxid,
-                                               &frozenxid_updated, 
&minmulti_updated, false);
+                                               &frozenxid_updated, 
&minmulti_updated, false, true);
 
        /*
         * Report results to the cumulative stats system, too.
@@ -2101,7 +2075,7 @@ lazy_scan_noprune(LVRelState *vacrel,
                tuple.t_len = ItemIdGetLength(itemid);
                tuple.t_tableOid = RelationGetRelid(vacrel->rel);
 
-               switch (HeapTupleSatisfiesVacuum(&tuple, 
vacrel->cutoffs.OldestXmin,
+               switch (HeapTupleSatisfiesVacuum(vacrel->rel, &tuple, 
vacrel->cutoffs.OldestXmin,
                                                                                
 buf))
                {
                        case HEAPTUPLE_DELETE_IN_PROGRESS:
diff --git a/src/include/replication/logical.h 
b/src/include/replication/logical.h
index d15ef76e433..aafb393efea 100644
--- a/src/include/replication/logical.h
+++ b/src/include/replication/logical.h
@@ -110,8 +110,6 @@ typedef struct LogicalDecodingContext
        bool            prepared_write;
        XLogRecPtr      write_location;
        TransactionId write_xid;
-       /* Are we processing the end LSN of a transaction? */
-       bool            end_xact;
 
        /*
         * True if the logical decoding context being used for the creation


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

Reply via email to