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 f3d7d1fb2aa Fix conflict on access/nbtree access/rmgrdesc
f3d7d1fb2aa is described below

commit f3d7d1fb2aaa46a4dfcf764d27a32dcfe718aeb8
Author: Jinbao Chen <[email protected]>
AuthorDate: Sun Jul 13 16:17:49 2025 +0800

    Fix conflict on access/nbtree access/rmgrdesc
---
 src/backend/access/nbtree/nbtdedup.c   |  5 ---
 src/backend/access/nbtree/nbtinsert.c  |  5 ---
 src/backend/access/nbtree/nbtree.c     |  8 ----
 src/backend/access/nbtree/nbtsort.c    |  6 ---
 src/backend/access/rmgrdesc/nbtdesc.c  | 13 +-----
 src/backend/access/rmgrdesc/smgrdesc.c |  8 +---
 src/backend/access/rmgrdesc/xactdesc.c | 79 +++++++++-------------------------
 src/include/access/xact.h              |  8 ++--
 src/include/storage/relfilelocator.h   | 15 +++++++
 src/include/storage/relfilenode.h      | 15 -------
 10 files changed, 42 insertions(+), 120 deletions(-)

diff --git a/src/backend/access/nbtree/nbtdedup.c 
b/src/backend/access/nbtree/nbtdedup.c
index 43609c51a98..d4db0b28f28 100644
--- a/src/backend/access/nbtree/nbtdedup.c
+++ b/src/backend/access/nbtree/nbtdedup.c
@@ -55,13 +55,8 @@ static bool _bt_posting_valid(IndexTuple posting);
  * LP_DEAD bits set.
  */
 void
-<<<<<<< HEAD
-_bt_dedup_pass(Relation rel, Buffer buf, Relation heapRel, IndexTuple newitem,
-                          Size newitemsz, bool bottomupdedup)
-=======
 _bt_dedup_pass(Relation rel, Buffer buf, IndexTuple newitem, Size newitemsz,
                           bool bottomupdedup)
->>>>>>> REL_16_9
 {
        OffsetNumber offnum,
                                minoff,
diff --git a/src/backend/access/nbtree/nbtinsert.c 
b/src/backend/access/nbtree/nbtinsert.c
index 973ca5e866b..a6518839b59 100644
--- a/src/backend/access/nbtree/nbtinsert.c
+++ b/src/backend/access/nbtree/nbtinsert.c
@@ -2789,13 +2789,8 @@ _bt_delete_or_dedup_one_page(Relation rel, Relation 
heapRel,
 
        /* Perform deduplication pass (when enabled and index-is-allequalimage) 
*/
        if (BTGetDeduplicateItems(rel) && itup_key->allequalimage)
-<<<<<<< HEAD
-               _bt_dedup_pass(rel, buffer, heapRel, insertstate->itup,
-                                          insertstate->itemsz, (indexUnchanged 
|| uniquedup));
-=======
                _bt_dedup_pass(rel, buffer, insertstate->itup, 
insertstate->itemsz,
                                           (indexUnchanged || uniquedup));
->>>>>>> REL_16_9
 }
 
 /*
diff --git a/src/backend/access/nbtree/nbtree.c 
b/src/backend/access/nbtree/nbtree.c
index 2da48c7941a..efa2d376e0b 100644
--- a/src/backend/access/nbtree/nbtree.c
+++ b/src/backend/access/nbtree/nbtree.c
@@ -166,19 +166,11 @@ btbuildempty(Relation index)
         * when the index is large, but for an empty index, it's better to use 
the
         * buffer cache to avoid the smgrimmedsync().
         */
-<<<<<<< HEAD
        PageEncryptInplace(metapage, INIT_FORKNUM,
                                           BTREE_METAPAGE);
-       PageSetChecksumInplace(metapage, BTREE_METAPAGE);
-       smgrwrite(index->rd_smgr, INIT_FORKNUM, BTREE_METAPAGE,
-                         (char *) metapage, true);
-       log_newpage(&index->rd_smgr->smgr_rnode.node, INIT_FORKNUM,
-                               BTREE_METAPAGE, metapage, true);
-=======
        metabuf = ReadBufferExtended(index, INIT_FORKNUM, P_NEW, RBM_NORMAL, 
NULL);
        Assert(BufferGetBlockNumber(metabuf) == BTREE_METAPAGE);
        _bt_lockbuf(index, metabuf, BT_WRITE);
->>>>>>> REL_16_9
 
        START_CRIT_SECTION();
 
diff --git a/src/backend/access/nbtree/nbtsort.c 
b/src/backend/access/nbtree/nbtsort.c
index 247ac7cf365..2e5afe6f044 100644
--- a/src/backend/access/nbtree/nbtsort.c
+++ b/src/backend/access/nbtree/nbtsort.c
@@ -660,17 +660,11 @@ _bt_blwritepage(BTWriteState *wstate, Page page, 
BlockNumber blkno)
        while (blkno > wstate->btws_pages_written)
        {
                if (!wstate->btws_zeropage)
-<<<<<<< HEAD
-                       wstate->btws_zeropage = (Page) palloc0(BLCKSZ);
-               /* don't set checksum or encryption for all-zero page */
-               smgrextend(wstate->index->rd_smgr, MAIN_FORKNUM,
-=======
                        wstate->btws_zeropage = (Page) palloc_aligned(BLCKSZ,
                                                                                
                                  PG_IO_ALIGN_SIZE,
                                                                                
                                  MCXT_ALLOC_ZERO);
                /* don't set checksum for all-zero page */
                smgrextend(RelationGetSmgr(wstate->index), MAIN_FORKNUM,
->>>>>>> REL_16_9
                                   wstate->btws_pages_written++,
                                   wstate->btws_zeropage,
                                   true);
diff --git a/src/backend/access/rmgrdesc/nbtdesc.c 
b/src/backend/access/rmgrdesc/nbtdesc.c
index c77b50b35b5..fd71945d468 100644
--- a/src/backend/access/rmgrdesc/nbtdesc.c
+++ b/src/backend/access/rmgrdesc/nbtdesc.c
@@ -101,12 +101,8 @@ btree_desc(StringInfo buf, XLogReaderState *record)
                        {
                                xl_btree_insert *xlrec = (xl_btree_insert *) 
rec;
 
-<<<<<<< HEAD
-                               appendStringInfo(buf, "off %u", xlrec->offnum);
-                               out_insert(buf, info, record);
-=======
                                appendStringInfo(buf, "off: %u", xlrec->offnum);
->>>>>>> REL_16_9
+                               out_insert(buf, info, record);
                                break;
                        }
                case XLOG_BTREE_SPLIT_L:
@@ -142,11 +138,6 @@ btree_desc(StringInfo buf, XLogReaderState *record)
                        {
                                xl_btree_delete *xlrec = (xl_btree_delete *) 
rec;
 
-<<<<<<< HEAD
-                               appendStringInfo(buf, "latestRemovedXid %u; 
ndeleted %u; nupdated %u",
-                                                                
xlrec->latestRemovedXid, xlrec->ndeleted, xlrec->nupdated);
-                               out_delete(buf, record);
-=======
                                appendStringInfo(buf, "snapshotConflictHorizon: 
%u, ndeleted: %u, nupdated: %u",
                                                                 
xlrec->snapshotConflictHorizon,
                                                                 
xlrec->ndeleted, xlrec->nupdated);
@@ -154,7 +145,7 @@ btree_desc(StringInfo buf, XLogReaderState *record)
                                if (XLogRecHasBlockData(record, 0))
                                        delvacuum_desc(buf, 
XLogRecGetBlockData(record, 0, NULL),
                                                                   
xlrec->ndeleted, xlrec->nupdated);
->>>>>>> REL_16_9
+                               out_delete(buf, record);
                                break;
                        }
                case XLOG_BTREE_MARK_PAGE_HALFDEAD:
diff --git a/src/backend/access/rmgrdesc/smgrdesc.c 
b/src/backend/access/rmgrdesc/smgrdesc.c
index 18ea54b4854..b49302a4029 100644
--- a/src/backend/access/rmgrdesc/smgrdesc.c
+++ b/src/backend/access/rmgrdesc/smgrdesc.c
@@ -26,18 +26,12 @@ smgr_desc(StringInfo buf, XLogReaderState *record)
        if (info == XLOG_SMGR_CREATE)
        {
                xl_smgr_create *xlrec = (xl_smgr_create *) rec;
-<<<<<<< HEAD
-               char       *path = relpathperm(xlrec->rnode, xlrec->forkNum);
+               char       *path = relpathperm(xlrec->rlocator, xlrec->forkNum);
 #ifndef FRONTEND
                appendStringInfo(buf, "%s; smgr: %s", path, 
smgr_get_name(xlrec->impl));
 #else
                appendStringInfo(buf, "%s; smgr: %s", path, xlrec->impl == 
SMGR_MD ? "heap" : (xlrec->impl == SMGR_AO ? "ao" : "unknown"));
 #endif
-=======
-               char       *path = relpathperm(xlrec->rlocator, xlrec->forkNum);
-
-               appendStringInfoString(buf, path);
->>>>>>> REL_16_9
                pfree(path);
        }
        else if (info == XLOG_SMGR_TRUNCATE)
diff --git a/src/backend/access/rmgrdesc/xactdesc.c 
b/src/backend/access/rmgrdesc/xactdesc.c
index cddb72b93ce..072421406e2 100644
--- a/src/backend/access/rmgrdesc/xactdesc.c
+++ b/src/backend/access/rmgrdesc/xactdesc.c
@@ -16,11 +16,8 @@
 
 #include "access/transam.h"
 #include "access/xact.h"
-<<<<<<< HEAD
 #include "storage/dbdirnode.h"
-=======
 #include "replication/origin.h"
->>>>>>> REL_16_9
 #include "storage/sinval.h"
 #include "storage/standbydefs.h"
 #include "utils/timestamp.h"
@@ -84,12 +81,8 @@ ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, 
xl_xact_parsed_commit *pars
                parsed->nrels = xl_rellocators->nrels;
                parsed->xlocators = xl_rellocators->xlocators;
 
-<<<<<<< HEAD
-               data += MinSizeOfXactRelfilenodes;
-               data += xl_relfilenodes->nrels * 
sizeof(RelFileNodePendingDelete);
-=======
                data += MinSizeOfXactRelfileLocators;
-               data += xl_rellocators->nrels * sizeof(RelFileLocator);
+               data += xl_rellocators->nrels * 
sizeof(RelFileNodePendingDelete);
        }
 
        if (parsed->xinfo & XACT_XINFO_HAS_DROPPED_STATS)
@@ -101,7 +94,6 @@ ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, 
xl_xact_parsed_commit *pars
 
                data += MinSizeOfXactStatsItems;
                data += xl_drops->nitems * sizeof(xl_xact_stats_item);
->>>>>>> REL_16_9
        }
 
        if (parsed->xinfo & XACT_XINFO_HAS_INVALS)
@@ -213,9 +205,8 @@ ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, 
xl_xact_parsed_abort *parsed)
                parsed->nrels = xl_rellocator->nrels;
                parsed->xlocators = xl_rellocator->xlocators;
 
-<<<<<<< HEAD
-               data += MinSizeOfXactRelfilenodes;
-               data += xl_relfilenodes->nrels * 
sizeof(RelFileNodePendingDelete);
+               data += MinSizeOfXactRelfileLocators;
+               data += xl_rellocator->nrels * sizeof(RelFileNodePendingDelete);
        }
 
        if (parsed->xinfo & XACT_XINFO_HAS_DELDBS)
@@ -227,9 +218,6 @@ ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, 
xl_xact_parsed_abort *parsed)
 
                data += MinSizeOfXactDelDbs;
                data += xl_deldbs->ndeldbs * sizeof(DbDirNode);
-=======
-               data += MinSizeOfXactRelfileLocators;
-               data += xl_rellocator->nrels * sizeof(RelFileLocator);
        }
 
        if (parsed->xinfo & XACT_XINFO_HAS_DROPPED_STATS)
@@ -241,7 +229,6 @@ ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, 
xl_xact_parsed_abort *parsed)
 
                data += MinSizeOfXactStatsItems;
                data += xl_drops->nitems * sizeof(xl_xact_stats_item);
->>>>>>> REL_16_9
        }
 
        if (parsed->xinfo & XACT_XINFO_HAS_TWOPHASE)
@@ -304,13 +291,6 @@ ParsePrepareRecord(uint8 info, xl_xact_prepare *xlrec, 
xl_xact_parsed_prepare *p
        parsed->subxacts = (TransactionId *) bufptr;
        bufptr += MAXALIGN(xlrec->nsubxacts * sizeof(TransactionId));
 
-<<<<<<< HEAD
-       parsed->xnodes = (RelFileNodePendingDelete *) bufptr;
-       bufptr += MAXALIGN(xlrec->ncommitrels * sizeof(RelFileNode));
-
-       parsed->abortnodes = (RelFileNodePendingDelete *) bufptr;
-       bufptr += MAXALIGN(xlrec->nabortrels * sizeof(RelFileNode));
-=======
        parsed->xlocators = (RelFileLocator *) bufptr;
        bufptr += MAXALIGN(xlrec->ncommitrels * sizeof(RelFileLocator));
 
@@ -322,7 +302,6 @@ ParsePrepareRecord(uint8 info, xl_xact_prepare *xlrec, 
xl_xact_parsed_prepare *p
 
        parsed->abortstats = (xl_xact_stats_item *) bufptr;
        bufptr += MAXALIGN(xlrec->nabortstats * sizeof(xl_xact_stats_item));
->>>>>>> REL_16_9
 
        parsed->msgs = (SharedInvalidationMessage *) bufptr;
        bufptr += MAXALIGN(xlrec->ninvalmsgs * 
sizeof(SharedInvalidationMessage));
@@ -330,11 +309,7 @@ ParsePrepareRecord(uint8 info, xl_xact_prepare *xlrec, 
xl_xact_parsed_prepare *p
 
 static void
 xact_desc_relations(StringInfo buf, char *label, int nrels,
-<<<<<<< HEAD
-                                       RelFileNodePendingDelete *xnodes)
-=======
-                                       RelFileLocator *xlocators)
->>>>>>> REL_16_9
+                                       RelFileNodePendingDelete *xlocators)
 {
        int                     i;
 
@@ -343,15 +318,11 @@ xact_desc_relations(StringInfo buf, char *label, int 
nrels,
                appendStringInfo(buf, "; %s:", label);
                for (i = 0; i < nrels; i++)
                {
-<<<<<<< HEAD
-                       BackendId  backendId = xnodes[i].isTempRelation ?
+                       BackendId  backendId = xlocators[i].isTempRelation ?
                                                                  
TempRelBackendId : InvalidBackendId;
-                       char       *path = relpathbackend(xnodes[i].node,
+                       char       *path = relpathbackend(xlocators[i].node,
                                                                                
          backendId,
                                                                                
          MAIN_FORKNUM);
-=======
-                       char       *path = relpathperm(xlocators[i], 
MAIN_FORKNUM);
->>>>>>> REL_16_9
 
                        appendStringInfo(buf, " %s", path);
                        pfree(path);
@@ -412,7 +383,9 @@ xact_desc_commit(StringInfo buf, uint8 info, xl_xact_commit 
*xlrec, RepOriginId
                                                           parsed.tsId,
                                                           
XactCompletionRelcacheInitFileInval(parsed.xinfo));
 
-<<<<<<< HEAD
+       if (XactCompletionApplyFeedback(parsed.xinfo))
+               appendStringInfoString(buf, "; apply_feedback");
+
        if (parsed.ndeldbs > 0)
        {
                appendStringInfoString(buf, "; deldbs:");
@@ -427,10 +400,6 @@ xact_desc_commit(StringInfo buf, uint8 info, 
xl_xact_commit *xlrec, RepOriginId
        }
        if (xlrec->tablespace_oid_to_delete_on_commit != InvalidOid)
                appendStringInfo(buf, "; tablespace_oid_to_delete_on_commit: 
%u", xlrec->tablespace_oid_to_delete_on_commit);
-=======
-       if (XactCompletionApplyFeedback(parsed.xinfo))
-               appendStringInfoString(buf, "; apply_feedback");
->>>>>>> REL_16_9
 
        if (XactCompletionForceSyncCommit(parsed.xinfo))
                appendStringInfoString(buf, "; sync");
@@ -481,7 +450,17 @@ xact_desc_abort(StringInfo buf, uint8 info, xl_xact_abort 
*xlrec, RepOriginId or
 
        xact_desc_relations(buf, "rels", parsed.nrels, parsed.xlocators);
        xact_desc_subxacts(buf, parsed.nsubxacts, parsed.subxacts);
-<<<<<<< HEAD
+
+       if (parsed.xinfo & XACT_XINFO_HAS_ORIGIN)
+       {
+               appendStringInfo(buf, "; origin: node %u, lsn %X/%X, at %s",
+                                                origin_id,
+                                                
LSN_FORMAT_ARGS(parsed.origin_lsn),
+                                                
timestamptz_to_str(parsed.origin_timestamp));
+       }
+
+       xact_desc_stats(buf, "", parsed.nstats, parsed.stats);
+
 
        if (parsed.ndeldbs > 0)
        {
@@ -489,7 +468,7 @@ xact_desc_abort(StringInfo buf, uint8 info, xl_xact_abort 
*xlrec, RepOriginId or
                for (int i = 0; i < parsed.ndeldbs; i++)
                {
                        char *path =
-                                        
GetDatabasePath(parsed.deldbs[i].database, parsed.deldbs[i].tablespace);
+                                       
GetDatabasePath(parsed.deldbs[i].database, parsed.deldbs[i].tablespace);
 
                        appendStringInfo(buf, " %s", path);
                        pfree(path);
@@ -497,17 +476,7 @@ xact_desc_abort(StringInfo buf, uint8 info, xl_xact_abort 
*xlrec, RepOriginId or
        }
        if (xlrec->tablespace_oid_to_delete_on_abort != InvalidOid)
                appendStringInfo(buf, "; tablespace_oid_to_delete_on_abort: 
%u", xlrec->tablespace_oid_to_delete_on_abort);
-=======
-
-       if (parsed.xinfo & XACT_XINFO_HAS_ORIGIN)
-       {
-               appendStringInfo(buf, "; origin: node %u, lsn %X/%X, at %s",
-                                                origin_id,
-                                                
LSN_FORMAT_ARGS(parsed.origin_lsn),
-                                                
timestamptz_to_str(parsed.origin_timestamp));
-       }
 
-       xact_desc_stats(buf, "", parsed.nstats, parsed.stats);
 }
 
 static void
@@ -539,7 +508,6 @@ xact_desc_prepare(StringInfo buf, uint8 info, 
xl_xact_prepare *xlrec, RepOriginI
                                                 origin_id,
                                                 
LSN_FORMAT_ARGS(parsed.origin_lsn),
                                                 
timestamptz_to_str(parsed.origin_timestamp));
->>>>>>> REL_16_9
 }
 
 static void
@@ -597,15 +565,10 @@ xact_desc(StringInfo buf, XLogReaderState *record)
        }
        else if (info == XLOG_XACT_PREPARE)
        {
-<<<<<<< HEAD
-               TwoPhaseFileHeader *tpfh = (TwoPhaseFileHeader*) rec;
-               xact_desc_prepare(buf, XLogRecGetInfo(record), tpfh);
-=======
                xl_xact_prepare *xlrec = (xl_xact_prepare *) rec;
 
                xact_desc_prepare(buf, XLogRecGetInfo(record), xlrec,
                                                  XLogRecGetOrigin(record));
->>>>>>> REL_16_9
        }
        else if (info == XLOG_XACT_ASSIGNMENT)
        {
diff --git a/src/include/access/xact.h b/src/include/access/xact.h
index 8e4675f7092..71aa66ee2fb 100644
--- a/src/include/access/xact.h
+++ b/src/include/access/xact.h
@@ -294,7 +294,7 @@ typedef struct xl_xact_relfilenodes
 typedef struct xl_xact_relfilelocators
 {
        int                     nrels;                  /* number of relations 
*/
-       RelFileLocator xlocators[FLEXIBLE_ARRAY_MEMBER];
+       RelFileNodePendingDelete xlocators[FLEXIBLE_ARRAY_MEMBER];
 } xl_xact_relfilelocators;
 #define MinSizeOfXactRelfileLocators offsetof(xl_xact_relfilelocators, 
xlocators)
 
@@ -420,8 +420,7 @@ typedef struct xl_xact_parsed_commit
        TransactionId *subxacts;
 
        int                     nrels;
-       RelFileNodePendingDelete *xnodes;
-       RelFileLocator *xlocators;
+       RelFileNodePendingDelete *xlocators;
 
        int                     nstats;
        xl_xact_stats_item *stats;
@@ -435,8 +434,7 @@ typedef struct xl_xact_parsed_commit
        TransactionId twophase_xid; /* only for 2PC */
        char            twophase_gid[GIDSIZE];  /* only for 2PC */
        int                     nabortrels;             /* only for 2PC */
-       RelFileNodePendingDelete *abortnodes;   /* only for 2PC */
-       RelFileLocator *abortlocators;  /* only for 2PC */
+       RelFileNodePendingDelete *abortlocators;        /* only for 2PC */
        int                     nabortstats;    /* only for 2PC */
        xl_xact_stats_item *abortstats; /* only for 2PC */
 
diff --git a/src/include/storage/relfilelocator.h 
b/src/include/storage/relfilelocator.h
index 61cf0169bd7..937de9cac62 100644
--- a/src/include/storage/relfilelocator.h
+++ b/src/include/storage/relfilelocator.h
@@ -61,6 +61,21 @@ typedef struct RelFileLocator
        RelFileNumber relNumber;        /* relation */
 } RelFileLocator;
 
+/*
+ * Augmenting a relfilenode with a SMGR implementation identifier provides a
+ * way to make optimal decisions in smgr and md layer. This is purposefully
+ * kept out of RelFileNode for performance concerns where RelFileNode used in
+ * a hotpath for BufferTag hashing. The isTempRelation flag is necessary to
+ * support file-system removal of temporary relations on a two-phase
+ * commit/abort.
+ */
+typedef struct RelFileNodePendingDelete
+{
+       RelFileLocator node;
+       int smgr_which; /* which SMGR implementation to use */
+       bool isTempRelation;
+} RelFileNodePendingDelete;
+
 /*
  * Augmenting a relfilelocator with the backend ID provides all the information
  * we need to locate the physical storage.  The backend ID is InvalidBackendId
diff --git a/src/include/storage/relfilenode.h 
b/src/include/storage/relfilenode.h
index da5f8d1b08b..ee76e22f3a5 100644
--- a/src/include/storage/relfilenode.h
+++ b/src/include/storage/relfilenode.h
@@ -104,19 +104,4 @@ inline static bool RelFileNode_IsEmpty(
                    relFileNode->relNode == 0);
 }
 
-/*
- * Augmenting a relfilenode with a SMGR implementation identifier provides a
- * way to make optimal decisions in smgr and md layer. This is purposefully
- * kept out of RelFileNode for performance concerns where RelFileNode used in
- * a hotpath for BufferTag hashing. The isTempRelation flag is necessary to
- * support file-system removal of temporary relations on a two-phase
- * commit/abort.
- */
-typedef struct RelFileNodePendingDelete
-{
-       RelFileNode node;
-       int smgr_which; /* which SMGR implementation to use */
-       bool isTempRelation;
-} RelFileNodePendingDelete;
-
 #endif                                                 /* RELFILENODE_H */


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

Reply via email to