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 b067d75b099 Fix conflicts for storage/smgr
b067d75b099 is described below

commit b067d75b0990c8690363086531610fafd6ccefef
Author: Jinbao Chen <[email protected]>
AuthorDate: Mon Jul 28 09:41:59 2025 +0800

    Fix conflicts for storage/smgr
---
 src/backend/storage/smgr/md.c   | 14 +------
 src/backend/storage/smgr/smgr.c | 89 ++++-------------------------------------
 src/backend/storage/sync/sync.c |  9 -----
 src/include/storage/smgr.h      | 10 +++--
 4 files changed, 14 insertions(+), 108 deletions(-)

diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index aa728d8de4c..eff6954c78e 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -253,7 +253,6 @@ mdcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo)
 }
 
 /*
-<<<<<<< HEAD
  *     mdcreate_ao() -- Create a AO segfile
  *
  * If isRedo is true, it's okay for the file to exist already.
@@ -294,10 +293,7 @@ mdcreate_ao(RelFileNodeBackend rnode, int32 
segmentFileNum, bool isRedo)
 }
 
 /*
- *     mdunlink() -- Unlink a relation.
-=======
  * mdunlink() -- Unlink a relation.
->>>>>>> REL_16_9
  *
  * Note that we're passed a RelFileLocatorBackend --- by the time this is 
called,
  * there won't be an SMgrRelation hashtable entry anymore.
@@ -1341,11 +1337,7 @@ ForgetDatabaseSyncRequests(Oid dbid)
  * DropRelationFiles -- drop files of all given relations
  */
 void
-<<<<<<< HEAD
 DropRelationFiles(RelFileNodePendingDelete *delrels, int ndelrels, bool isRedo)
-=======
-DropRelationFiles(RelFileLocator *delrels, int ndelrels, bool isRedo)
->>>>>>> REL_16_9
 {
        SMgrRelation *srels;
        int                     i;
@@ -1660,11 +1652,7 @@ _mdnblocks(SMgrRelation reln, ForkNumber forknum, 
MdfdVec *seg)
 int
 mdsyncfiletag(const FileTag *ftag, char *path)
 {
-<<<<<<< HEAD
-       SMgrRelation reln = smgropen(ftag->rnode, InvalidBackendId, 0, NULL);
-=======
-       SMgrRelation reln = smgropen(ftag->rlocator, InvalidBackendId);
->>>>>>> REL_16_9
+       SMgrRelation reln = smgropen(ftag->rlocator, InvalidBackendId, 0, NULL);
        File            file;
        instr_time      io_start;
        bool            need_to_close;
diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c
index d8b1615bd1b..52d87ee24b9 100644
--- a/src/backend/storage/smgr/smgr.c
+++ b/src/backend/storage/smgr/smgr.c
@@ -6,13 +6,9 @@
  *       All file system operations in POSTGRES dispatch through these
  *       routines.
  *
-<<<<<<< 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
  *
  *
@@ -23,7 +19,6 @@
  */
 #include "postgres.h"
 
-<<<<<<< HEAD
 #include "access/aomd.h"
 #include "access/relation.h"
 #include "access/xact.h"
@@ -34,9 +29,7 @@
 #include "postmaster/autovacuum.h"
 #include "postmaster/postmaster.h"
 #include "access/xlog.h"
-=======
 #include "access/xlogutils.h"
->>>>>>> REL_16_9
 #include "lib/ilist.h"
 #include "storage/bufmgr.h"
 #include "storage/fd.h"
@@ -53,41 +46,10 @@
  * For example, disk quota extension will use these hooks to
  * detect active tables.
  */
-<<<<<<< HEAD
 file_create_hook_type file_create_hook = NULL;
 file_extend_hook_type file_extend_hook = NULL;
 file_truncate_hook_type file_truncate_hook = NULL;
 file_unlink_hook_type file_unlink_hook = NULL;
-=======
-typedef struct f_smgr
-{
-       void            (*smgr_init) (void);    /* may be NULL */
-       void            (*smgr_shutdown) (void);        /* may be NULL */
-       void            (*smgr_open) (SMgrRelation reln);
-       void            (*smgr_close) (SMgrRelation reln, ForkNumber forknum);
-       void            (*smgr_create) (SMgrRelation reln, ForkNumber forknum,
-                                                               bool isRedo);
-       bool            (*smgr_exists) (SMgrRelation reln, ForkNumber forknum);
-       void            (*smgr_unlink) (RelFileLocatorBackend rlocator, 
ForkNumber forknum,
-                                                               bool isRedo);
-       void            (*smgr_extend) (SMgrRelation reln, ForkNumber forknum,
-                                                               BlockNumber 
blocknum, const void *buffer, bool skipFsync);
-       void            (*smgr_zeroextend) (SMgrRelation reln, ForkNumber 
forknum,
-                                                                       
BlockNumber blocknum, int nblocks, bool skipFsync);
-       bool            (*smgr_prefetch) (SMgrRelation reln, ForkNumber forknum,
-                                                                 BlockNumber 
blocknum);
-       void            (*smgr_read) (SMgrRelation reln, ForkNumber forknum,
-                                                         BlockNumber blocknum, 
void *buffer);
-       void            (*smgr_write) (SMgrRelation reln, ForkNumber forknum,
-                                                          BlockNumber 
blocknum, const void *buffer, bool skipFsync);
-       void            (*smgr_writeback) (SMgrRelation reln, ForkNumber 
forknum,
-                                                                  BlockNumber 
blocknum, BlockNumber nblocks);
-       BlockNumber (*smgr_nblocks) (SMgrRelation reln, ForkNumber forknum);
-       void            (*smgr_truncate) (SMgrRelation reln, ForkNumber forknum,
-                                                                 BlockNumber 
old_blocks, BlockNumber nblocks);
-       void            (*smgr_immedsync) (SMgrRelation reln, ForkNumber 
forknum);
-} f_smgr;
->>>>>>> REL_16_9
 
 smgr_get_impl_hook_type smgr_get_impl_hook = NULL;
 
@@ -314,11 +276,7 @@ smgrAOGetDefault(void) {
  * This does not attempt to actually open the underlying file.
  */
 SMgrRelation
-<<<<<<< HEAD
-smgropen(RelFileNode rnode, BackendId backend, SMgrImpl which, Relation rel)
-=======
-smgropen(RelFileLocator rlocator, BackendId backend)
->>>>>>> REL_16_9
+smgropen(RelFileLocator rlocator, BackendId backend, SMgrImpl which, Relation 
rel)
 {
        RelFileLocatorBackend brlocator;
        SMgrRelation reln;
@@ -340,14 +298,9 @@ smgropen(RelFileLocator rlocator, BackendId backend)
        }
 
        /* Look up or create an entry */
-<<<<<<< HEAD
-       memset(&brnode, 0, sizeof(RelFileNodeBackend));
-       brnode.node = rnode;
-       brnode.backend = backend;
-=======
+       memset(&brlocator, 0, sizeof(RelFileLocatorBackend));
        brlocator.locator = rlocator;
        brlocator.backend = backend;
->>>>>>> REL_16_9
        reln = (SMgrRelation) hash_search(SMgrRelationHash,
                                                                          
&brlocator,
                                                                          
HASH_ENTER, &found);
@@ -652,17 +605,11 @@ smgrdounlinkall(SMgrRelation *rels, int nrels, bool 
isRedo)
        rlocators = palloc(sizeof(RelFileLocatorBackend) * nrels);
        for (i = 0; i < nrels; i++)
        {
-<<<<<<< HEAD
-               RelFileNodeBackend rnode = rels[i]->smgr_rnode;
-
-               rnodes[i] = rnode;
-=======
                RelFileLocatorBackend rlocator = rels[i]->smgr_rlocator;
                int                     which = rels[i]->smgr_which;
 
                rlocators[i] = rlocator;
 
->>>>>>> REL_16_9
                /* Close the forks at smgr level */
                for (forknum = 0; forknum <= MAX_FORKNUM; forknum++)
                        (*rels[i]->smgr).smgr_close(rels[i], forknum);
@@ -690,41 +637,25 @@ smgrdounlinkall(SMgrRelation *rels, int nrels, bool 
isRedo)
        for (i = 0; i < nrels; i++)
        {
                for (forknum = 0; forknum <= MAX_FORKNUM; forknum++)
-<<<<<<< HEAD
-                       (*rels[i]->smgr).smgr_unlink(rnodes[i], forknum, 
isRedo);
+                       (*rels[i]->smgr).smgr_unlink(rlocators[i], forknum, 
isRedo);
        }
 
        if (file_unlink_hook)
                for (i = 0; i < nrels; i++)
-                       (*file_unlink_hook)(rnodes[i]);
-
-       pfree(rnodes);
-=======
-                       smgrsw[which].smgr_unlink(rlocators[i], forknum, 
isRedo);
-       }
+                       (*file_unlink_hook)(rlocators[i]);
 
        pfree(rlocators);
->>>>>>> REL_16_9
 }
 
 
 /*
  * smgrextend() -- Add a new block to a file.
  *
-<<<<<<< HEAD
- *             The semantics are nearly the same as smgrwrite(): write at the
- *             specified position.  However, this is to be used for the case of
- *             extending a relation (i.e., blocknum is at or beyond the current
- *             EOF).  Note that we assume writing a block beyond current EOF
- *             causes intervening file space to become filled with zeroes.
- *             failure we clean up by truncating.
-=======
  * The semantics are nearly the same as smgrwrite(): write at the
  * specified position.  However, this is to be used for the case of
  * extending a relation (i.e., blocknum is at or beyond the current
  * EOF).  Note that we assume writing a block beyond current EOF
  * causes intervening file space to become filled with zeroes.
->>>>>>> REL_16_9
  */
 void
 smgrextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
@@ -942,12 +873,7 @@ smgrtruncate2(SMgrRelation reln, ForkNumber *forknum, int 
nforks,
                /* Make the cached size is invalid if we encounter an error. */
                reln->smgr_cached_nblocks[forknum[i]] = InvalidBlockNumber;
 
-<<<<<<< HEAD
                (*reln->smgr).smgr_truncate(reln, forknum[i], nblocks[i]);
-=======
-               smgrsw[reln->smgr_which].smgr_truncate(reln, forknum[i],
-                                                                               
           old_nblocks[i], nblocks[i]);
->>>>>>> REL_16_9
 
                /*
                 * We might as well update the local smgr_cached_nblocks 
values. The
@@ -959,7 +885,7 @@ smgrtruncate2(SMgrRelation reln, ForkNumber *forknum, int 
nforks,
                reln->smgr_cached_nblocks[forknum[i]] = nblocks[i];
        }
        if (file_truncate_hook)
-               (*file_truncate_hook)(reln->smgr_rnode);
+               (*file_truncate_hook)(reln->smgr_rlocator);
 }
 
 /*
@@ -1031,13 +957,13 @@ AtEOXact_SMgr(void)
        }
 }
 
-<<<<<<< HEAD
 const char *smgr_get_name(SMgrImpl impl)
 {
        if (impl > SMGR_MAX_ID)
                return "invalid";
        return smgrsw[impl].smgr_name ? smgrsw[impl].smgr_name : "unknown";
-=======
+}
+
 /*
  * This routine is called when we are ordered to release all open files by a
  * ProcSignalBarrier.
@@ -1047,5 +973,4 @@ ProcessBarrierSmgrRelease(void)
 {
        smgrreleaseall();
        return true;
->>>>>>> REL_16_9
 }
diff --git a/src/backend/storage/sync/sync.c b/src/backend/storage/sync/sync.c
index 50d3d4836a9..69777cce3e1 100644
--- a/src/backend/storage/sync/sync.c
+++ b/src/backend/storage/sync/sync.c
@@ -38,13 +38,10 @@
 #include "utils/inval.h"
 #include "utils/memutils.h"
 
-<<<<<<< HEAD
 #include "utils/faultinjector.h"
 
 static MemoryContext pendingOpsCxt; /* context for the pending ops state  */
 
-=======
->>>>>>> REL_16_9
 /*
  * In some contexts (currently, standalone backends and the checkpointer)
  * we keep track of pending fsync operations: we need to remember all relation
@@ -576,15 +573,9 @@ RememberSyncRequest(const FileTag *ftag, SyncRequestType 
type)
                {
                        PendingUnlinkEntry *pue = (PendingUnlinkEntry *) 
lfirst(cell);
 
-<<<<<<< HEAD
-                       if (entry->tag.handler == ftag->handler &&
-                               syncsw[ftag->handler].sync_filetagmatches(ftag, 
&entry->tag))
-                               entry->canceled = true;
-=======
                        if (pue->tag.handler == ftag->handler &&
                                syncsw[ftag->handler].sync_filetagmatches(ftag, 
&pue->tag))
                                pue->canceled = true;
->>>>>>> REL_16_9
                }
        }
        else if (type == SYNC_UNLINK_REQUEST)
diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h
index 622d1e95eb7..069f0f20300 100644
--- a/src/include/storage/smgr.h
+++ b/src/include/storage/smgr.h
@@ -141,6 +141,8 @@ typedef struct f_smgr
                                                                bool isRedo);
        void            (*smgr_extend) (SMgrRelation reln, ForkNumber forknum,
                                                                BlockNumber 
blocknum, char *buffer, bool skipFsync);
+       void            (*smgr_zeroextend) (SMgrRelation reln, ForkNumber 
forknum,
+                                                                       
BlockNumber blocknum, int nblocks, bool skipFsync);
        bool            (*smgr_prefetch) (SMgrRelation reln, ForkNumber forknum,
                                                                  BlockNumber 
blocknum);
        void            (*smgr_read) (SMgrRelation reln, ForkNumber forknum,
@@ -232,16 +234,16 @@ extern const char* smgr_get_name(SMgrImpl impl);
  * For example, disk quota extension will use these hooks to
  * detect active tables.
  */
-typedef void (*file_create_hook_type)(RelFileNodeBackend rnode);
+typedef void (*file_create_hook_type)(RelFileLocatorBackend rnode);
 extern PGDLLIMPORT file_create_hook_type file_create_hook;
 
-typedef void (*file_extend_hook_type)(RelFileNodeBackend rnode);
+typedef void (*file_extend_hook_type)(RelFileLocatorBackend rnode);
 extern PGDLLIMPORT file_extend_hook_type file_extend_hook;
 
-typedef void (*file_truncate_hook_type)(RelFileNodeBackend rnode);
+typedef void (*file_truncate_hook_type)(RelFileLocatorBackend rnode);
 extern PGDLLIMPORT file_truncate_hook_type file_truncate_hook;
 
-typedef void (*file_unlink_hook_type)(RelFileNodeBackend rnode);
+typedef void (*file_unlink_hook_type)(RelFileLocatorBackend rnode);
 extern PGDLLIMPORT file_unlink_hook_type file_unlink_hook;
 
 /*


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

Reply via email to