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 95ee4ea01f0 Fix conflict for transam partly
95ee4ea01f0 is described below

commit 95ee4ea01f06706f457a134ef6657bd732cfa1db
Author: Jinbao Chen <[email protected]>
AuthorDate: Thu Jul 10 17:38:23 2025 +0800

    Fix conflict for transam partly
---
 src/backend/access/transam/parallel.c    |  13 +--
 src/backend/access/transam/rmgr.c        |  21 -----
 src/backend/access/transam/xact.c        | 137 +++----------------------------
 src/backend/access/transam/xlogarchive.c |  62 +-------------
 src/backend/access/transam/xlogreader.c  |  25 ++----
 src/backend/access/transam/xlogutils.c   |  19 +----
 src/common/percentrepl.c                 |   8 ++
 src/include/access/xact.h                |   2 +-
 8 files changed, 32 insertions(+), 255 deletions(-)

diff --git a/src/backend/access/transam/parallel.c 
b/src/backend/access/transam/parallel.c
index cc85901075e..08b669a451c 100644
--- a/src/backend/access/transam/parallel.c
+++ b/src/backend/access/transam/parallel.c
@@ -91,8 +91,9 @@
 #define PARALLEL_KEY_REINDEX_STATE                     
UINT64CONST(0xFFFFFFFFFFFF000C)
 #define PARALLEL_KEY_RELMAPPER_STATE           UINT64CONST(0xFFFFFFFFFFFF000D)
 #define PARALLEL_KEY_UNCOMMITTEDENUMS          UINT64CONST(0xFFFFFFFFFFFF000E)
-<<<<<<< HEAD
-#define PARALLEL_KEY_GP_DSA                                    
UINT64CONST(0xFFFFFFFFFFFF000F)
+#define PARALLEL_KEY_CLIENTCONNINFO                    
UINT64CONST(0xFFFFFFFFFFFF000F)
+
+#define PARALLEL_KEY_GP_DSA                                    
UINT64CONST(0xFFFFFFFFFFFF0010)
 
 
 /* Shared parallel dsm entry table size. estimated number = 100 connections * 
average 50 slices. */
@@ -106,9 +107,6 @@ typedef struct CdbParallelAuxState
        int             ic_htab_size;
        char            interconnect_address[NI_MAXHOST];
 } CdbParallelAuxState;
-=======
-#define PARALLEL_KEY_CLIENTCONNINFO                    
UINT64CONST(0xFFFFFFFFFFFF000F)
->>>>>>> REL_16_9
 
 /* Fixed-size parallel state. */
 typedef struct FixedParallelState
@@ -439,13 +437,8 @@ InitializeParallelDSM(ParallelContext *pcxt)
                shm_toc_insert(pcxt->toc, PARALLEL_KEY_COMBO_CID, 
combocidspace);
 
                /*
-<<<<<<< HEAD
-                * Serialize the transaction snapshot if the transaction
-                * isolation-level uses a transaction snapshot.
-=======
                 * Serialize the transaction snapshot if the transaction 
isolation
                 * level uses a transaction snapshot.
->>>>>>> REL_16_9
                 */
                if (IsolationUsesXactSnapshot())
                {
diff --git a/src/backend/access/transam/rmgr.c 
b/src/backend/access/transam/rmgr.c
index e3736814ba1..89649a5a690 100644
--- a/src/backend/access/transam/rmgr.c
+++ b/src/backend/access/transam/rmgr.c
@@ -34,24 +34,16 @@
 #include "utils/builtins.h"
 #include "utils/relmapper.h"
 
-<<<<<<< HEAD
 #include "access/bitmap_xlog.h"
 #include "access/distributedlog.h"
 #include "cdb/cdbappendonlyxlog.h"
 
 
-/* must be kept in sync with RmgrData definition in xlog_internal.h */
-#define PG_RMGR(symname,name,redo,desc,identify,startup,cleanup,mask,decode) \
-       { name, redo, desc, identify, startup, cleanup, mask, decode },
-
-RmgrData RmgrTable[RM_MAX_ID + 1] = {
-=======
 /* must be kept in sync with RmgrData definition in xlog_internal.h */
 #define PG_RMGR(symname,name,redo,desc,identify,startup,cleanup,mask,decode) \
        { name, redo, desc, identify, startup, cleanup, mask, decode },
 
 RmgrData       RmgrTable[RM_MAX_ID + 1] = {
->>>>>>> REL_16_9
 #include "access/rmgrlist.h"
 };
 
@@ -102,21 +94,13 @@ RmgrNotFound(RmgrId rmid)
  * Register a new custom WAL resource manager.
  *
  * Resource manager IDs must be globally unique across all extensions. Refer
-<<<<<<< HEAD
- * to https://wiki.postgresql.org/wiki/CustomWALResourceManager to reserve a
-=======
  * to https://wiki.postgresql.org/wiki/CustomWALResourceManagers to reserve a
->>>>>>> REL_16_9
  * unique RmgrId for your extension, to avoid conflicts with other extension
  * developers. During development, use RM_EXPERIMENTAL_ID to avoid needlessly
  * reserving a new ID.
  */
 void
-<<<<<<< HEAD
-RegisterCustomRmgr(RmgrId rmid, RmgrData *rmgr)
-=======
 RegisterCustomRmgr(RmgrId rmid, const RmgrData *rmgr)
->>>>>>> REL_16_9
 {
        if (rmgr->rm_name == NULL || strlen(rmgr->rm_name) == 0)
                ereport(ERROR, (errmsg("custom resource manager name is 
invalid"),
@@ -146,13 +130,8 @@ RegisterCustomRmgr(RmgrId rmid, const RmgrData *rmgr)
 
                if (!pg_strcasecmp(RmgrTable[existing_rmid].rm_name, 
rmgr->rm_name))
                        ereport(ERROR,
-<<<<<<< HEAD
-                               (errmsg("failed to register custom resource 
manager \"%s\" with ID %d", rmgr->rm_name, rmid),
-                                errdetail("Existing resource manager with ID 
%d has the same name.", existing_rmid)));
-=======
                                        (errmsg("failed to register custom 
resource manager \"%s\" with ID %d", rmgr->rm_name, rmid),
                                         errdetail("Existing resource manager 
with ID %d has the same name.", existing_rmid)));
->>>>>>> REL_16_9
        }
 
        /* register it */
diff --git a/src/backend/access/transam/xact.c 
b/src/backend/access/transam/xact.c
index 9258a0145d3..f38f4907044 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -30,11 +30,8 @@
 #include "access/xact.h"
 #include "access/xlog.h"
 #include "access/xloginsert.h"
-<<<<<<< HEAD
 #include "access/xact_storage_tablespace.h"
-=======
 #include "access/xlogrecovery.h"
->>>>>>> REL_16_9
 #include "access/xlogutils.h"
 #include "catalog/catalog.h"
 #include "catalog/index.h"
@@ -255,12 +252,9 @@ typedef struct TransactionStateData
        bool            didLogXid;              /* has xid been included in WAL 
record? */
        int                     parallelModeLevel;      /* 
Enter/ExitParallelMode counter */
        bool            chain;                  /* start a new block after this 
one */
-<<<<<<< HEAD
+       bool            topXidLogged;   /* for a subxact: is top-level XID 
logged? */
        bool            assigned;               /* assigned to top-level XID */
        bool            executorSaysXactDoesWrites;     /* GP executor says 
xact does writes */
-=======
-       bool            topXidLogged;   /* for a subxact: is top-level XID 
logged? */
->>>>>>> REL_16_9
        struct TransactionStateData *parent;    /* back link to parent */
        struct TransactionStateData *fastLink;  /* back link to jump to parent 
for efficient search */
 } TransactionStateData;
@@ -651,12 +645,12 @@ MarkCurrentTransactionIdLoggedIfAny(void)
                CurrentTransactionState->didLogXid = true;
 }
 
-<<<<<<< HEAD
 void
 MarkTopTransactionWriteXLogOnExecutor(void)
 {
        TopXactexecutorDidWriteXLog = true;
-=======
+}
+
 /*
  * IsSubxactTopXidLogPending
  *
@@ -706,7 +700,6 @@ MarkSubxactTopXidLogged(void)
        Assert(IsSubxactTopXidLogPending());
 
        CurrentTransactionState->topXidLogged = true;
->>>>>>> REL_16_9
 }
 
 /*
@@ -1572,13 +1565,9 @@ RecordTransactionCommit(void)
        bool            markXidCommitted;
        TransactionId latestXid = InvalidTransactionId;
        int                     nrels;
-<<<<<<< HEAD
        RelFileNodePendingDelete *rels;
        DbDirNode       *deldbs;
        int                     ndeldbs;
-=======
-       RelFileLocator *rels;
->>>>>>> REL_16_9
        int                     nchildren;
        TransactionId *children;
        int                     ndroppedstats = 0;
@@ -1687,7 +1676,6 @@ RecordTransactionCommit(void)
                                          replorigin_session_origin != 
DoNotReplicateId);
 
                /*
-<<<<<<< HEAD
                 * Begin commit critical section and insert the commit XLOG 
record.
                 */
                /* Tell bufmgr and smgr to prepare for commit */
@@ -1698,8 +1686,6 @@ RecordTransactionCommit(void)
                        
SIMPLE_FAULT_INJECTOR("before_xlog_xact_distributed_commit");
 
                /*
-=======
->>>>>>> REL_16_9
                 * Mark ourselves as within our "commit critical section".  This
                 * forces any concurrent checkpoint to wait until we've updated
                 * pg_xact.  Without this, it is possible for the checkpoint to 
set
@@ -1711,50 +1697,19 @@ RecordTransactionCommit(void)
                 * RecordTransactionAbort.  That's because loss of a 
transaction abort
                 * is noncritical; the presumption would be that it aborted, 
anyway.
                 *
-<<<<<<< HEAD
-                * It's safe to change the delayChkpt flag of our own backend 
without
-                * holding the ProcArrayLock, since we're the only one 
modifying it.
-                * This makes checkpoint's determination of which xacts are 
delayChkpt
-                * a bit fuzzy, but it doesn't matter.
-                *
-                * In GPDB, if this is a distributed transaction, checkpoint 
process
-                * should hold off obtaining the REDO pointer while a backend is
-                * writing distributed commit xlog record and changing state of 
the
-                * distributed transaction.  Otherwise, it is possible that a 
commit
-                * record is written by a transaction and the checkpointer 
determines
-                * REDO pointer to be after this commit record.  But the 
transaction is
-                * yet to change its state to INSERTED_DISRIBUTED_COMMITTED and 
the
-                * checkpoint process fails to record this transaction in the
-                * checkpoint.  Crash recovery will never see the commit record 
for
-                * this transaction and the second phase of 2PC will never 
happen.  The
-                * delayChkpt flag avoids this situation by blocking 
checkpointer until a
-                * backend has finished updating the state.
-                */
-               Assert(!MyProc->delayChkpt);
-=======
                 * It's safe to change the delayChkptFlags flag of our own 
backend
                 * without holding the ProcArrayLock, since we're the only one
                 * modifying it.  This makes checkpoint's determination of 
which xacts
                 * are delaying the checkpoint a bit fuzzy, but it doesn't 
matter.
                 */
                Assert((MyProc->delayChkptFlags & DELAY_CHKPT_START) == 0);
->>>>>>> REL_16_9
                START_CRIT_SECTION();
                MyProc->delayChkptFlags |= DELAY_CHKPT_START;
 
-<<<<<<< HEAD
-               SetCurrentTransactionStopTimestamp();
-
                SIMPLE_FAULT_INJECTOR("onephase_transaction_commit");
 
-               XactLogCommitRecord(xactStopTimestamp,
-                                                       
GetPendingTablespaceForDeletionForCommit(),
-=======
-               /*
-                * Insert the commit XLOG record.
-                */
                XactLogCommitRecord(GetCurrentTransactionStopTimestamp(),
->>>>>>> REL_16_9
+                                                       
GetPendingTablespaceForDeletionForCommit(),
                                                        nchildren, children, 
nrels, rels,
                                                        ndroppedstats, 
droppedstats,
                                                        nmsgs, invalMessages,
@@ -1914,15 +1869,11 @@ RecordTransactionCommit(void)
        /* Reset XactLastRecEnd until the next transaction writes something */
        XactLastRecEnd = 0;
 cleanup:
-<<<<<<< HEAD
-       /* And clean up local data */
-=======
        /* Clean up local data */
        if (rels)
                pfree(rels);
        if (ndroppedstats)
                pfree(droppedstats);
->>>>>>> REL_16_9
 
        return latestXid;
 }
@@ -2124,11 +2075,13 @@ RecordTransactionAbort(bool isSubXact)
        TransactionId xid;
        TransactionId latestXid;
        int                     nrels;
-<<<<<<< HEAD
        RelFileNodePendingDelete *rels;
+       int                     ndroppedstats = 0;
+       xl_xact_stats_item *droppedstats = NULL;
        int                     nchildren;
        TransactionId *children;
        TimestampTz xact_time;
+       bool            replorigin;
        DbDirNode       *deldbs;
        int                     ndeldbs;
        bool            isQEReader;
@@ -2152,15 +2105,6 @@ RecordTransactionAbort(bool isSubXact)
                xid = InvalidTransactionId;
        else
                xid = GetCurrentTransactionIdIfAny();
-=======
-       RelFileLocator *rels;
-       int                     ndroppedstats = 0;
-       xl_xact_stats_item *droppedstats = NULL;
-       int                     nchildren;
-       TransactionId *children;
-       TimestampTz xact_time;
-       bool            replorigin;
->>>>>>> REL_16_9
 
        /*
         * If we haven't been assigned an XID, nobody will care whether we 
aborted
@@ -2220,11 +2164,8 @@ RecordTransactionAbort(bool isSubXact)
                                           
GetPendingTablespaceForDeletionForAbort(),
                                           nchildren, children,
                                           nrels, rels,
-<<<<<<< HEAD
                                           ndeldbs, deldbs,
-=======
                                           ndroppedstats, droppedstats,
->>>>>>> REL_16_9
                                           MyXactFlags, InvalidTransactionId,
                                           NULL);
 
@@ -2273,16 +2214,14 @@ RecordTransactionAbort(bool isSubXact)
        if (!isSubXact)
                XactLastRecEnd = 0;
 
-<<<<<<< HEAD
        if (max_wal_senders > 0)
                WalSndWakeup();
-=======
+
        /* And clean up local data */
        if (rels)
                pfree(rels);
        if (ndroppedstats)
                pfree(droppedstats);
->>>>>>> REL_16_9
 
        return latestXid;
 }
@@ -3168,7 +3107,6 @@ CommitTransaction(void)
        DoPendingDbDeletes(true);
 
        /*
-<<<<<<< HEAD
         * Only QD holds the session level lock this long for a movedb 
operation.
         * This is to prevent another transaction from moving database objects 
into
         * the source database oid directory while it is being deleted. We don't
@@ -3179,8 +3117,6 @@ CommitTransaction(void)
                MoveDbSessionLockRelease();
 
        /*
-=======
->>>>>>> REL_16_9
         * Send out notification signals to other backends (and do other
         * post-commit NOTIFY cleanup).  This must not happen until after our
         * transaction is fully done from the viewpoint of other backends.
@@ -3203,11 +3139,8 @@ CommitTransaction(void)
        AtEOXact_PgStat(true, is_parallel_worker);
        AtEOXact_Snapshot(true, false);
        AtEOXact_ApplyLauncher(true);
-<<<<<<< HEAD
        AtEOXact_WorkFile();
-=======
        AtEOXact_LogicalRepWorkers(true);
->>>>>>> REL_16_9
        pgstat_report_xact_timestamp(0);
 
        CurrentResourceOwner = NULL;
@@ -3542,13 +3475,10 @@ PrepareTransaction(void)
        AtEOXact_HashTables(true);
        /* don't call AtEOXact_PgStat here; we fixed pgstat state above */
        AtEOXact_Snapshot(true, true);
-<<<<<<< HEAD
        AtEOXact_WorkFile();
-=======
        /* we treat PREPARE as ROLLBACK so far as waking workers goes */
        AtEOXact_ApplyLauncher(false);
        AtEOXact_LogicalRepWorkers(false);
->>>>>>> REL_16_9
        pgstat_report_xact_timestamp(0);
 
        CurrentResourceOwner = NULL;
@@ -3825,11 +3755,8 @@ AbortTransaction(void)
                AtEOXact_HashTables(false);
                AtEOXact_PgStat(false, is_parallel_worker);
                AtEOXact_ApplyLauncher(false);
-<<<<<<< HEAD
                AtEOXact_WorkFile();
-=======
                AtEOXact_LogicalRepWorkers(false);
->>>>>>> REL_16_9
                pgstat_report_xact_timestamp(0);
        }
 
@@ -4088,17 +4015,12 @@ CommitTransactionCommand(void)
        TransactionState s = CurrentTransactionState;
        SavedTransactionCharacteristics savetc;
 
-<<<<<<< HEAD
        if (Gp_role == GP_ROLE_EXECUTE && !Gp_is_writer)
                elog(DEBUG1,"CommitTransactionCommand: called as segment Reader 
in state %s",
                     BlockStateAsString(s->blockState));
 
-       if (s->chain)
-               SaveTransactionCharacteristics();
-=======
        /* Must save in case we need to restore below */
        SaveTransactionCharacteristics(&savetc);
->>>>>>> REL_16_9
 
        switch (s->blockState)
        {
@@ -4794,11 +4716,7 @@ CallXactCallbacks(XactEvent event)
                /* allow callbacks to unregister themselves when called */
                next = item->next;
                item->callback(event, item->arg);
-<<<<<<< HEAD
-
-=======
        }
->>>>>>> REL_16_9
 }
 
 /* Register or deregister callback functions for start/end Xact.  Call only 
once. */
@@ -5952,7 +5870,6 @@ RollbackAndReleaseCurrentSubTransaction(void)
        CleanupSubTransaction();
 
        s = CurrentTransactionState;    /* changed by pop */
-<<<<<<< HEAD
        AssertState(s->blockState == TBLOCK_SUBINPROGRESS ||
                                s->blockState == TBLOCK_INPROGRESS ||
                                s->blockState == TBLOCK_IMPLICIT_INPROGRESS ||
@@ -5967,12 +5884,6 @@ RollbackAndReleaseCurrentSubTransaction(void)
                                                        errmsg("DTX 
RollbackAndReleaseCurrentSubTransaction dispatch failed")));
                }
        }
-=======
-       Assert(s->blockState == TBLOCK_SUBINPROGRESS ||
-                  s->blockState == TBLOCK_INPROGRESS ||
-                  s->blockState == TBLOCK_IMPLICIT_INPROGRESS ||
-                  s->blockState == TBLOCK_STARTED);
->>>>>>> REL_16_9
 }
 
 /*
@@ -7055,12 +6966,8 @@ XLogRecPtr
 XactLogCommitRecord(TimestampTz commit_time,
                                        Oid tablespace_oid_to_delete_on_commit,
                                        int nsubxacts, TransactionId *subxacts,
-<<<<<<< HEAD
                                        int nrels, RelFileNodePendingDelete 
*rels,
-=======
-                                       int nrels, RelFileLocator *rels,
                                        int ndroppedstats, xl_xact_stats_item 
*droppedstats,
->>>>>>> REL_16_9
                                        int nmsgs, SharedInvalidationMessage 
*msgs,
                                        int ndeldbs, DbDirNode *deldbs,
                                        bool relcacheInval,
@@ -7210,10 +7117,7 @@ XactLogCommitRecord(TimestampTz commit_time,
                XLogRegisterData((char *) (&xl_relfilelocators),
                                                 MinSizeOfXactRelfileLocators);
                XLogRegisterData((char *) rels,
-<<<<<<< HEAD
                                                 nrels * 
sizeof(RelFileNodePendingDelete));
-=======
-                                                nrels * 
sizeof(RelFileLocator));
        }
 
        if (xl_xinfo.xinfo & XACT_XINFO_HAS_DROPPED_STATS)
@@ -7222,7 +7126,6 @@ XactLogCommitRecord(TimestampTz commit_time,
                                                 MinSizeOfXactStatsItems);
                XLogRegisterData((char *) droppedstats,
                                                 ndroppedstats * 
sizeof(xl_xact_stats_item));
->>>>>>> REL_16_9
        }
 
        if (xl_xinfo.xinfo & XACT_XINFO_HAS_INVALS)
@@ -7276,26 +7179,18 @@ XLogRecPtr
 XactLogAbortRecord(TimestampTz abort_time,
                                   Oid tablespace_oid_to_delete_on_abort,
                                   int nsubxacts, TransactionId *subxacts,
-<<<<<<< HEAD
                                   int nrels, RelFileNodePendingDelete *rels,
                                   int ndeldbs, DbDirNode *deldbs,
-=======
-                                  int nrels, RelFileLocator *rels,
                                   int ndroppedstats, xl_xact_stats_item 
*droppedstats,
->>>>>>> REL_16_9
                                   int xactflags, TransactionId twophase_xid,
                                   const char *twophase_gid)
 {
        xl_xact_abort xlrec;
        xl_xact_xinfo xl_xinfo;
        xl_xact_subxacts xl_subxacts;
-<<<<<<< HEAD
        xl_xact_relfilenodes xl_relfilenodes;
        xl_xact_deldbs xl_deldbs;
-=======
-       xl_xact_relfilelocators xl_relfilelocators;
        xl_xact_stats_items xl_dropped_stats;
->>>>>>> REL_16_9
        xl_xact_twophase xl_twophase;
        xl_xact_dbinfo xl_dbinfo;
        xl_xact_origin xl_origin;
@@ -7330,21 +7225,20 @@ XactLogAbortRecord(TimestampTz abort_time,
        if (nrels > 0)
        {
                xl_xinfo.xinfo |= XACT_XINFO_HAS_RELFILELOCATORS;
-               xl_relfilelocators.nrels = nrels;
+               xl_relfilenodes.nrels = nrels;
                info |= XLR_SPECIAL_REL_UPDATE;
        }
 
-<<<<<<< HEAD
        if (ndeldbs > 0)
        {
                xl_xinfo.xinfo |= XACT_XINFO_HAS_DELDBS;
                xl_deldbs.ndeldbs = ndeldbs;
-=======
+       }
+
        if (ndroppedstats > 0)
        {
                xl_xinfo.xinfo |= XACT_XINFO_HAS_DROPPED_STATS;
                xl_dropped_stats.nitems = ndroppedstats;
->>>>>>> REL_16_9
        }
 
        if (TransactionIdIsValid(twophase_xid))
@@ -7403,10 +7297,7 @@ XactLogAbortRecord(TimestampTz abort_time,
                XLogRegisterData((char *) (&xl_relfilelocators),
                                                 MinSizeOfXactRelfileLocators);
                XLogRegisterData((char *) rels,
-<<<<<<< HEAD
                                                 nrels * 
sizeof(RelFileNodePendingDelete));
-=======
-                                                nrels * 
sizeof(RelFileLocator));
        }
 
        if (xl_xinfo.xinfo & XACT_XINFO_HAS_DROPPED_STATS)
@@ -7415,7 +7306,6 @@ XactLogAbortRecord(TimestampTz abort_time,
                                                 MinSizeOfXactStatsItems);
                XLogRegisterData((char *) droppedstats,
                                                 ndroppedstats * 
sizeof(xl_xact_stats_item));
->>>>>>> REL_16_9
        }
 
        if (xl_xinfo.xinfo & XACT_XINFO_HAS_DELDBS)
@@ -7701,7 +7591,6 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, 
TransactionId xid,
                 */
                XLogFlush(lsn);
 
-<<<<<<< HEAD
                DropRelationFiles(parsed->xnodes, parsed->nrels, true);
        }
 
@@ -7711,9 +7600,6 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, 
TransactionId xid,
         */
        DropDatabaseDirectories(parsed->deldbs, parsed->ndeldbs, true);
        
DoTablespaceDeletionForRedoXlog(parsed->tablespace_oid_to_delete_on_abort);
-=======
-               DropRelationFiles(parsed->xlocators, parsed->nrels, true);
-       }
 
        if (parsed->nstats > 0)
        {
@@ -7722,7 +7608,6 @@ xact_redo_abort(xl_xact_parsed_abort *parsed, 
TransactionId xid,
 
                pgstat_execute_transactional_drops(parsed->nstats, 
parsed->stats, true);
        }
->>>>>>> REL_16_9
 }
 
 static void
diff --git a/src/backend/access/transam/xlogarchive.c 
b/src/backend/access/transam/xlogarchive.c
index 9e1a24f4e9e..93f2a494343 100644
--- a/src/backend/access/transam/xlogarchive.c
+++ b/src/backend/access/transam/xlogarchive.c
@@ -325,54 +325,8 @@ ExecuteRecoveryCommand(const char *command, const char 
*commandName,
        /*
         * construct the command to be executed
         */
-<<<<<<< HEAD
-       dp = xlogRecoveryCmd;
-       endp = xlogRecoveryCmd + MAXPGPATH - 1;
-       *endp = '\0';
-
-       for (sp = command; *sp; sp++)
-       {
-               if (*sp == '%')
-               {
-                       switch (sp[1])
-                       {
-                               case 'r':
-                                       /* %r: filename of last restartpoint */
-                                       sp++;
-                                       strlcpy(dp, lastRestartPointFname, endp 
- dp);
-                                       dp += strlen(dp);
-                                       break;
-                               case 'c':
-                                       /* GPDB: %c: contentId of segment */
-                                       Assert(GpIdentity.segindex != 
UNINITIALIZED_GP_IDENTITY_VALUE);
-                                       sp++;
-                                       pg_ltoa(GpIdentity.segindex, contentid);
-                                       strlcpy(dp, contentid, endp - dp);
-                                       dp += strlen(dp);
-                                       break;
-                               case '%':
-                                       /* convert %% to a single % */
-                                       sp++;
-                                       if (dp < endp)
-                                               *dp++ = *sp;
-                                       break;
-                               default:
-                                       /* otherwise treat the % as not special 
*/
-                                       if (dp < endp)
-                                               *dp++ = *sp;
-                                       break;
-                       }
-               }
-               else
-               {
-                       if (dp < endp)
-                               *dp++ = *sp;
-               }
-       }
-       *dp = '\0';
-=======
-       xlogRecoveryCmd = replace_percent_placeholders(command, commandName, 
"r", lastRestartPointFname);
->>>>>>> REL_16_9
+       pg_ltoa(GpIdentity.segindex, contentid);
+       xlogRecoveryCmd = replace_percent_placeholders(command, commandName, 
"r", lastRestartPointFname, "c", contentid);
 
        ereport(DEBUG3,
                        (errmsg_internal("executing %s \"%s\"", commandName, 
command)));
@@ -522,17 +476,6 @@ XLogArchiveNotify(const char *xlog)
        }
 
        /*
-<<<<<<< HEAD
-        * Timeline history files are given the highest archival priority to
-        * lower the chance that a promoted standby will choose a timeline that
-        * is already in use.  However, the archiver ordinarily tries to gather
-        * multiple files to archive from each scan of the archive_status
-        * directory, which means that newly created timeline history files
-        * could be left unarchived for a while.  To ensure that the archiver
-        * picks up timeline history files as soon as possible, we force the
-        * archiver to scan the archive_status directory the next time it looks
-        * for a file to archive.
-=======
         * Timeline history files are given the highest archival priority to 
lower
         * the chance that a promoted standby will choose a timeline that is
         * already in use.  However, the archiver ordinarily tries to gather
@@ -542,7 +485,6 @@ XLogArchiveNotify(const char *xlog)
         * timeline history files as soon as possible, we force the archiver to
         * scan the archive_status directory the next time it looks for a file 
to
         * archive.
->>>>>>> REL_16_9
         */
        if (IsTLHistoryFileName(xlog))
                PgArchForceDirScan();
diff --git a/src/backend/access/transam/xlogreader.c 
b/src/backend/access/transam/xlogreader.c
index 32166feef62..5f2e426355b 100644
--- a/src/backend/access/transam/xlogreader.c
+++ b/src/backend/access/transam/xlogreader.c
@@ -562,10 +562,7 @@ XLogDecodeNextRecord(XLogReaderState *state, bool 
nonblocking)
        state->errormsg_buf[0] = '\0';
        decoded = NULL;
 
-<<<<<<< HEAD
        ResetDecoder(state);
-=======
->>>>>>> REL_16_9
        state->abortedRecPtr = InvalidXLogRecPtr;
        state->missingContrecPtr = InvalidXLogRecPtr;
 
@@ -596,10 +593,7 @@ XLogDecodeNextRecord(XLogReaderState *state, bool 
nonblocking)
        }
 
 restart:
-<<<<<<< HEAD
-=======
        state->nonblocking = nonblocking;
->>>>>>> REL_16_9
        state->currRecPtr = RecPtr;
        assembled = false;
 
@@ -764,10 +758,7 @@ restart:
                        if (pageHeader->xlp_info & 
XLP_FIRST_IS_OVERWRITE_CONTRECORD)
                        {
                                state->overwrittenRecPtr = RecPtr;
-<<<<<<< HEAD
                                ResetDecoder(state);
-=======
->>>>>>> REL_16_9
                                RecPtr = targetPagePtr;
                                goto restart;
                        }
@@ -948,9 +939,6 @@ err:
                 */
                state->abortedRecPtr = RecPtr;
                state->missingContrecPtr = targetPagePtr;
-<<<<<<< HEAD
-       }
-=======
 
                /*
                 * If we got here without reporting an error, make sure an 
error is
@@ -962,7 +950,6 @@ err:
 
        if (decoded && decoded->oversized)
                pfree(decoded);
->>>>>>> REL_16_9
 
        /*
         * Invalidate the read state. We might read from a different source 
after
@@ -1383,7 +1370,6 @@ XLogReaderValidatePageHeader(XLogReaderState *state, 
XLogRecPtr recptr,
        return true;
 }
 
-<<<<<<< HEAD
 /*
  * In GPDB, this is used in the test in src/test/walrep, so we need it in the
  * backend, too.
@@ -1391,8 +1377,6 @@ XLogReaderValidatePageHeader(XLogReaderState *state, 
XLogRecPtr recptr,
 /* #ifdef FRONTEND */
 #if 1
 
-=======
->>>>>>> REL_16_9
 /*
  * Forget about an error produced by XLogReaderValidatePageHeader().
  */
@@ -2121,13 +2105,17 @@ RestoreBlockImage(XLogReaderState *record, uint8 
block_id, char *page)
        {
                char errormessage[MAX_ERRORMSG_LEN];
                /* If a backup block image is compressed, decompress it */
-<<<<<<< HEAD
                if (!zstd_decompress_backupblock(ptr, bkpb->bimg_len, tmp.data,
                                                                                
 BLCKSZ - bkpb->hole_length,
                                                                                
 errormessage))
                {
                        report_invalid_record(record, "invalid compressed image 
at %X/%X, block %d (%s)",
-=======
+                                                                 
LSN_FORMAT_ARGS(record->ReadRecPtr),
+                                                                 block_id,
+                                                                 errormessage);
+                       return false;
+               }
+
                bool            decomp_success = true;
 
                if ((bkpb->bimg_info & BKPIMAGE_COMPRESS_PGLZ) != 0)
@@ -2170,7 +2158,6 @@ RestoreBlockImage(XLogReaderState *record, uint8 
block_id, char *page)
                else
                {
                        report_invalid_record(record, "could not restore image 
at %X/%X compressed with unknown method, block %d",
->>>>>>> REL_16_9
                                                                  
LSN_FORMAT_ARGS(record->ReadRecPtr),
                                                                  block_id,
                                                                  errormessage);
diff --git a/src/backend/access/transam/xlogutils.c 
b/src/backend/access/transam/xlogutils.c
index 7867555c98e..eda3140da80 100644
--- a/src/backend/access/transam/xlogutils.c
+++ b/src/backend/access/transam/xlogutils.c
@@ -8,13 +8,9 @@
  * None of this code is used during normal system operation.
  *
  *
-<<<<<<< HEAD
  * Portions Copyright (c) 2006-2008, Greenplum inc
  * Portions Copyright (c) 2012-Present VMware, Inc. or its affiliates.
- * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
-=======
  * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
->>>>>>> REL_16_9
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * src/backend/access/transam/xlogutils.c
@@ -509,13 +505,6 @@ XLogReadBufferExtended(RelFileLocator rlocator, ForkNumber 
forknum,
 
        Assert(blkno != P_NEW);
 
-<<<<<<< HEAD
-       /*
-        * Open the relation at smgr level.  Relations using shared buffers need
-        * the default SMGR implementation.
-        */
-       smgr = smgropen(rnode, InvalidBackendId, SMGR_MD, NULL);
-=======
        /* Do we have a clue where the buffer might be already? */
        if (BufferIsValid(recent_buffer) &&
                mode == RBM_NORMAL &&
@@ -526,8 +515,7 @@ XLogReadBufferExtended(RelFileLocator rlocator, ForkNumber 
forknum,
        }
 
        /* Open the relation at smgr level */
-       smgr = smgropen(rlocator, InvalidBackendId);
->>>>>>> REL_16_9
+       smgr = smgropen(rlocator, InvalidBackendId, SMGR_MD, NULL);
 
        /*
         * Create the target file if it doesn't already exist.  This lets us 
cope
@@ -664,13 +652,8 @@ CreateFakeRelcacheEntry(RelFileLocator rlocator)
         * In recovery, we are running by ourselves and can't have any lock
         * conflicts.  While syncing, we already hold AccessExclusiveLock.
         */
-<<<<<<< HEAD
-       rel->rd_lockInfo.lockRelId.dbId = rnode.dbNode;
-       rel->rd_lockInfo.lockRelId.relId = (Oid)rnode.relNode;
-=======
        rel->rd_lockInfo.lockRelId.dbId = rlocator.dbOid;
        rel->rd_lockInfo.lockRelId.relId = rlocator.relNumber;
->>>>>>> REL_16_9
 
        rel->rd_smgr = NULL;
 
diff --git a/src/common/percentrepl.c b/src/common/percentrepl.c
index 7aa85fdc940..fa4925c06fb 100644
--- a/src/common/percentrepl.c
+++ b/src/common/percentrepl.c
@@ -22,6 +22,7 @@
 
 #include "common/percentrepl.h"
 #include "lib/stringinfo.h"
+#include "utils/builtins.h"
 
 /*
  * replace_percent_placeholders
@@ -86,6 +87,13 @@ replace_percent_placeholders(const char *instr, const char 
*param_name, const ch
                                                errdetail("String ends 
unexpectedly after escape character \"%%\"."));
 #endif
                        }
+                       else if (sp[1] == 'c')
+                       {
+                               /* GPDB: %c: contentId of segment */
+                               Assert(GpIdentity.segindex != 
UNINITIALIZED_GP_IDENTITY_VALUE);
+                               sp++;
+                               pg_ltoa(GpIdentity.segindex, contentid);
+                       }
                        else
                        {
                                /* Look up placeholder character */
diff --git a/src/include/access/xact.h b/src/include/access/xact.h
index 147f57f31ed..8e4675f7092 100644
--- a/src/include/access/xact.h
+++ b/src/include/access/xact.h
@@ -592,7 +592,7 @@ extern XLogRecPtr XactLogAbortRecord(TimestampTz abort_time,
                                                                         Oid 
tablespace_oid_to_abort,
                                                                         int 
nsubxacts, TransactionId *subxacts,
                                                                         int 
nrels, RelFileNodePendingDelete *rels,
-                                                                        int 
ndeldbs, DbDirNode *deldbs, RelFileLocator *rels,
+                                                                        int 
ndeldbs, DbDirNode *deldbs,
                                                                         int 
ndroppedstats,
                                                                         
xl_xact_stats_item *droppedstats,
                                                                         int 
xactflags, TransactionId twophase_xid,


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

Reply via email to