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 58ac0f9dcba Fix conflicts for storage/file
58ac0f9dcba is described below

commit 58ac0f9dcbac0c0962edd523bdf498883a2f143c
Author: Jinbao Chen <[email protected]>
AuthorDate: Sat Jul 26 16:52:29 2025 +0800

    Fix conflicts for storage/file
---
 src/backend/storage/file/buffile.c        | 43 ++++-------------------------
 src/backend/storage/file/copydir.c        | 16 ++---------
 src/backend/storage/file/fd.c             | 46 ++++++++++++++-----------------
 src/backend/storage/freespace/freespace.c |  3 --
 4 files changed, 27 insertions(+), 81 deletions(-)

diff --git a/src/backend/storage/file/buffile.c 
b/src/backend/storage/file/buffile.c
index becad6f657b..290f2284cb6 100644
--- a/src/backend/storage/file/buffile.c
+++ b/src/backend/storage/file/buffile.c
@@ -95,15 +95,10 @@ struct BufFile
        bool            dirty;                  /* does buffer need to be 
written? */
        bool            readOnly;               /* has the file been set to 
read only? */
 
-<<<<<<< HEAD
        char       *operation_name; /* for naming temporary files. */
 
-       SharedFileSet *fileset;         /* space for segment files if shared */
-       const char *name;                       /* name of this BufFile if 
shared */
-=======
        FileSet    *fileset;            /* space for fileset based segment 
files */
        const char *name;                       /* name of fileset based 
BufFile */
->>>>>>> REL_16_9
 
        /*
         * workfile_set for the files in current buffile. The workfile_set 
creator
@@ -127,7 +122,6 @@ struct BufFile
         */
        int                     curFile;                /* file index (0..n) 
part of current pos */
        off_t           curOffset;              /* offset part of current pos */
-<<<<<<< HEAD
        off_t           pos;                    /* next read/write position in 
buffer */
        int64           nbytes;                 /* total # of valid bytes in 
buffer */
        FakeAlignedBlock buffer;        /* GPDB: PG upstream uses 
PGAlignedBlock */
@@ -161,16 +155,6 @@ struct BufFile
        ZSTD_inBuffer compressed_buffer;
        bool            decompression_finished;
 #endif
-=======
-       int                     pos;                    /* next read/write 
position in buffer */
-       int                     nbytes;                 /* total # of valid 
bytes in buffer */
-
-       /*
-        * XXX Should ideally us PGIOAlignedBlock, but might need a way to avoid
-        * wasting per-file alignment padding when some users create many files.
-        */
-       PGAlignedBlock buffer;
->>>>>>> REL_16_9
 };
 
 static BufFile *makeBufFileCommon(int nfiles);
@@ -374,11 +358,7 @@ MakeNewFileSetSegment(BufFile *buffile, int segment)
  * unrelated SharedFileSet objects.
  */
 BufFile *
-<<<<<<< HEAD
-BufFileCreateShared(SharedFileSet *fileset, const char *name, workfile_set 
*work_set)
-=======
-BufFileCreateFileSet(FileSet *fileset, const char *name)
->>>>>>> REL_16_9
+BufFileCreateFileSet(FileSet *fileset, const char *name, workfile_set 
*work_set)
 {
        BufFile    *file;
 
@@ -471,7 +451,6 @@ BufFileOpenFileSet(FileSet *fileset, const char *name, int 
mode,
 }
 
 /*
-<<<<<<< HEAD
  * Open a shared BufFile with the given fileset, name, and mode.
  *
  * Parameters:
@@ -536,12 +515,8 @@ BufFileOpenSharedV2(SharedFileSet *fileset, const char 
*name, int mode)
 }
 
 /*
- * Delete a BufFile that was created by BufFileCreateShared in the given
- * SharedFileSet using the given name.
-=======
  * Delete a BufFile that was created by BufFileCreateFileSet in the given
  * FileSet using the given name.
->>>>>>> REL_16_9
  *
  * It is not necessary to delete files explicitly with this function.  It is
  * provided only as a way to delete files proactively, rather than waiting for
@@ -661,11 +636,7 @@ BufFileLoadBuffer(BufFile *file)
         */
        file->nbytes = FileRead(thisfile,
                                                        file->buffer.data,
-<<<<<<< HEAD
                                                        BLCKSZ,
-=======
-                                                       
sizeof(file->buffer.data),
->>>>>>> REL_16_9
                                                        file->curOffset,
                                                        
WAIT_EVENT_BUFFILE_READ);
        if (file->nbytes < 0)
@@ -859,7 +830,6 @@ BufFileReadCommon(BufFile *file, void *ptr, size_t size, 
bool exact, bool eofOK)
 }
 
 /*
-<<<<<<< HEAD
  * BufFileReadFromBuffer
  *
  * This function provides a faster implementation of Read which applies
@@ -871,7 +841,7 @@ BufFileReadCommon(BufFile *file, void *ptr, size_t size, 
bool exact, bool eofOK)
 void *
 BufFileReadFromBuffer(BufFile *file, size_t size)
 {
-       void       *result = NULL;
+       void *result = NULL;
 
        switch (file->state)
        {
@@ -898,7 +868,9 @@ BufFileReadFromBuffer(BufFile *file, size_t size)
        }
 
        return result;
-=======
+}
+
+/*
  * Legacy interface where the caller needs to check for end of file or short
  * reads.
  */
@@ -1280,7 +1252,6 @@ BufFileAppend(BufFile *target, BufFile *source)
 }
 
 /*
-<<<<<<< HEAD
  * Return filename of the underlying file.
  *
  * For debugging purposes only. Returns the filename of the
@@ -1631,12 +1602,8 @@ BufFileLoadCompressedBuffer(BufFile *file, void *buffer, 
size_t bufsize)
 #endif         /* HAVE_ZSTD */
 
 /*
- * Truncate a BufFile created by BufFileCreateShared up to the given fileno and
- * the offset.
-=======
  * Truncate a BufFile created by BufFileCreateFileSet up to the given fileno
  * and the offset.
->>>>>>> REL_16_9
  */
 void
 BufFileTruncateFileSet(BufFile *file, int fileno, off_t offset)
diff --git a/src/backend/storage/file/copydir.c 
b/src/backend/storage/file/copydir.c
index ee66c6b39bd..6c719416b2a 100644
--- a/src/backend/storage/file/copydir.c
+++ b/src/backend/storage/file/copydir.c
@@ -21,10 +21,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 
-<<<<<<< HEAD
 #include "crypto/bufenc.h"
-=======
->>>>>>> REL_16_9
 #include "common/file_utils.h"
 #include "miscadmin.h"
 #include "pgstat.h"
@@ -76,13 +73,8 @@ copydir(const char *fromdir, const char *todir, bool recurse)
                        if (recurse)
                                copydir(fromfile, tofile, true);
                }
-<<<<<<< HEAD
-               else if (S_ISREG(fst.st_mode))
-                       copy_file(fromfile, tofile, false);
-=======
                else if (xlde_type == PGFILETYPE_REG)
-                       copy_file(fromfile, tofile);
->>>>>>> REL_16_9
+                       copy_file(fromfile, tofile, false);
        }
        FreeDir(xldir);
 
@@ -125,11 +117,7 @@ copydir(const char *fromdir, const char *todir, bool 
recurse)
  * copy one file
  */
 void
-<<<<<<< HEAD
-copy_file(char *fromfile, char *tofile, bool encrypt_init_file)
-=======
-copy_file(const char *fromfile, const char *tofile)
->>>>>>> REL_16_9
+copy_file(const char *fromfile, const char *tofile, bool encrypt_init_file)
 {
        char       *buffer;
        int                     srcfd;
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 736d484f61e..7b0f28a9deb 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -3,13 +3,8 @@
  * fd.c
  *       Virtual file descriptor code.
  *
-<<<<<<< HEAD
  * Portions Copyright (c) 2007-2009, 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
  *
  * IDENTIFICATION
@@ -107,12 +102,9 @@
 #include "utils/guc.h"
 #include "utils/guc_hooks.h"
 #include "utils/resowner_private.h"
-<<<<<<< HEAD
 #include "utils/workfile_mgr.h"
 #include "utils/faultinjector.h"
-=======
 #include "utils/varlena.h"
->>>>>>> REL_16_9
 
 /* Define PG_FLUSH_DATA_WORKS if we have an implementation for pg_flush_data */
 #if defined(HAVE_SYNC_FILE_RANGE)
@@ -670,19 +662,21 @@ retry:
 }
 
 /*
-<<<<<<< HEAD
  * Retrying close in case it gets interrupted. If that happens, it will cause
  * unlink to fail later.
  */
 int
-gp_retry_close(int fd) {
+gp_retry_close(int fd)
+{
        int err = 0;
        do
        {
                err = close(fd);
        } while (err == -1 && errno == EINTR);
        return err;
-=======
+}
+
+/*
  * Truncate an open file to a given length.
  */
 static int
@@ -697,7 +691,6 @@ retry:
                goto retry;
 
        return ret;
->>>>>>> REL_16_9
 }
 
 /*
@@ -878,7 +871,6 @@ durable_unlink(const char *fname, int elevel)
 }
 
 /*
-<<<<<<< HEAD
  * durable_rename_excl -- rename a file in a durable manner.
  *
  * Similar to durable_rename(), except that this routine tries (but does not
@@ -2420,7 +2412,6 @@ FileSync(File file, uint32 wait_event_info)
 }
 
 /*
-<<<<<<< HEAD
  * Get the size of a physical file by using fstat()
  *
  * Returns size in bytes if successful, < 0 otherwise
@@ -2430,7 +2421,19 @@ FileDiskSize(File file)
 {
        int                     returnCode = 0;
        struct stat buf;
-=======
+
+       returnCode = FileAccess(file);
+       if (returnCode < 0)
+               return returnCode;
+
+       returnCode = fstat(VfdCache[file].fd, &buf);
+       if (returnCode < 0)
+               return returnCode;
+
+       return (int64) buf.st_size;
+}
+
+/*
  * Zero a region of the file.
  *
  * Returns 0 on success, -1 otherwise. In the latter case errno is set to the
@@ -2445,21 +2448,13 @@ FileZero(File file, off_t offset, off_t amount, uint32 
wait_event_info)
        Assert(FileIsValid(file));
 
        DO_DB(elog(LOG, "FileZero: %d (%s) " INT64_FORMAT " " INT64_FORMAT,
-                          file, VfdCache[file].fileName,
-                          (int64) offset, (int64) amount));
->>>>>>> REL_16_9
+                       file, VfdCache[file].fileName,
+                       (int64) offset, (int64) amount));
 
        returnCode = FileAccess(file);
        if (returnCode < 0)
                return returnCode;
 
-<<<<<<< HEAD
-       returnCode = fstat(VfdCache[file].fd, &buf);
-       if (returnCode < 0)
-               return returnCode;
-
-       return (int64) buf.st_size;
-=======
        pgstat_report_wait_start(wait_event_info);
        written = pg_pwrite_zeros(VfdCache[file].fd, amount, offset);
        pgstat_report_wait_end();
@@ -2527,7 +2522,6 @@ retry:
 #endif
 
        return FileZero(file, offset, amount, wait_event_info);
->>>>>>> REL_16_9
 }
 
 off_t
diff --git a/src/backend/storage/freespace/freespace.c 
b/src/backend/storage/freespace/freespace.c
index 7247a352902..d9722c1b9e3 100644
--- a/src/backend/storage/freespace/freespace.c
+++ b/src/backend/storage/freespace/freespace.c
@@ -25,11 +25,8 @@
 
 #include "access/heapam_xlog.h"
 #include "access/htup_details.h"
-<<<<<<< HEAD
 #include "access/xlog.h"
-=======
 #include "access/xloginsert.h"
->>>>>>> REL_16_9
 #include "access/xlogutils.h"
 #include "miscadmin.h"
 #include "storage/freespace.h"


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

Reply via email to