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 4d4398b6202 Fix conflict for backup
4d4398b6202 is described below

commit 4d4398b6202f0e413ece923dcf7331fdaa81a704
Author: Jinbao Chen <[email protected]>
AuthorDate: Fri Jul 18 13:07:47 2025 +0800

    Fix conflict for backup
---
 src/backend/backup/backup_manifest.c |   7 --
 src/backend/backup/basebackup.c      | 183 +----------------------------------
 2 files changed, 5 insertions(+), 185 deletions(-)

diff --git a/src/backend/backup/backup_manifest.c 
b/src/backend/backup/backup_manifest.c
index 53099836322..dfe56950a5f 100644
--- a/src/backend/backup/backup_manifest.c
+++ b/src/backend/backup/backup_manifest.c
@@ -13,18 +13,11 @@
 #include "postgres.h"
 
 #include "access/timeline.h"
-<<<<<<< HEAD:src/backend/replication/backup_manifest.c
-#include "libpq/libpq.h"
-#include "libpq/pqformat.h"
-#include "mb/pg_wchar.h"
-#include "replication/backup_manifest.h"
-=======
 #include "backup/backup_manifest.h"
 #include "backup/basebackup_sink.h"
 #include "libpq/libpq.h"
 #include "libpq/pqformat.h"
 #include "mb/pg_wchar.h"
->>>>>>> REL_16_9:src/backend/backup/backup_manifest.c
 #include "utils/builtins.h"
 #include "utils/json.h"
 
diff --git a/src/backend/backup/basebackup.c b/src/backend/backup/basebackup.c
index af73e2440f9..23c5b9af08b 100644
--- a/src/backend/backup/basebackup.c
+++ b/src/backend/backup/basebackup.c
@@ -25,11 +25,8 @@
 #include "commands/defrem.h"
 #include "common/compression.h"
 #include "common/file_perm.h"
-<<<<<<< HEAD:src/backend/replication/basebackup.c
 #include "common/kmgr_utils.h"
 #include "commands/progress.h"
-=======
->>>>>>> REL_16_9:src/backend/backup/basebackup.c
 #include "lib/stringinfo.h"
 #include "miscadmin.h"
 #include "nodes/pg_list.h"
@@ -52,7 +49,6 @@
 #include "utils/resowner.h"
 #include "utils/timestamp.h"
 
-<<<<<<< HEAD:src/backend/replication/basebackup.c
 #include "access/genam.h"
 #include "access/hash.h"
 #include "access/xact.h"
@@ -66,10 +62,8 @@
 #include "utils/elog.h"
 #include "utils/fmgroids.h"
 #include "utils/faultinjector.h"
-#include "utils/guc.h"
 #include "utils/snapmgr.h"
 #include "utils/tarrable.h"
-=======
 /*
  * How much data do we want to send in one CopyData message? Note that
  * this may also result in reading the underlying files in chunks of this
@@ -79,7 +73,6 @@
  * size, so use that value instead if it's bigger than our preference.
  */
 #define SINK_BUFFER_LENGTH                     Max(32768, BLCKSZ)
->>>>>>> REL_16_9:src/backend/backup/basebackup.c
 
 typedef struct
 {
@@ -100,24 +93,15 @@ typedef struct
        HTAB       *exclude;
 } basebackup_options;
 
-<<<<<<< HEAD:src/backend/replication/basebackup.c
 static bool match_exclude_list(char *path, HTAB *exclude);
 
-static int64 sendTablespace(char *path, char *oid, bool sizeonly,
-=======
 static int64 sendTablespace(bbsink *sink, char *path, char *spcoid, bool 
sizeonly,
->>>>>>> REL_16_9:src/backend/backup/basebackup.c
                                                        struct 
backup_manifest_info *manifest);
 static int64 sendDir(bbsink *sink, const char *path, int basepathlen, bool 
sizeonly,
                                         List *tablespaces, bool 
sendtblspclinks,
-<<<<<<< HEAD:src/backend/replication/basebackup.c
                                         backup_manifest_info *manifest, const 
char *spcoid,
                                         HTAB *exclude);
-static bool sendFile(const char *readfilename, const char *tarfilename,
-=======
-                                        backup_manifest_info *manifest, const 
char *spcoid);
 static bool sendFile(bbsink *sink, const char *readfilename, const char 
*tarfilename,
->>>>>>> REL_16_9:src/backend/backup/basebackup.c
                                         struct stat *statbuf, bool missing_ok, 
Oid dboid,
                                         backup_manifest_info *manifest, const 
char *spcoid);
 static void sendFileWithContent(bbsink *sink, const char *filename,
@@ -359,13 +343,8 @@ perform_base_backup(basebackup_options *opt, bbsink *sink)
                                tablespaceinfo *tmp = (tablespaceinfo *) 
lfirst(lc);
 
                                if (tmp->path == NULL)
-<<<<<<< HEAD:src/backend/replication/basebackup.c
-                                       tmp->size = sendDir(".", 1, true, 
tablespaces, true, NULL,
-                                                                               
NULL, opt->exclude);
-=======
                                        tmp->size = sendDir(sink, ".", 1, true, 
state.tablespaces,
-                                                                               
true, NULL, NULL);
->>>>>>> REL_16_9:src/backend/backup/basebackup.c
+                                                                               
true, NULL, NULL, opt->exclude);
                                else
                                        tmp->size = sendTablespace(sink, 
tmp->path, tmp->oid, true,
                                                                                
           NULL);
@@ -405,13 +384,8 @@ perform_base_backup(basebackup_options *opt, bbsink *sink)
                                }
 
                                /* Then the bulk of the files... */
-<<<<<<< HEAD:src/backend/replication/basebackup.c
-                               sendDir(".", 1, false, tablespaces, 
sendtblspclinks,
-                                               &manifest, NULL, opt->exclude);
-=======
                                sendDir(sink, ".", 1, false, state.tablespaces,
-                                               sendtblspclinks, &manifest, 
NULL);
->>>>>>> REL_16_9:src/backend/backup/basebackup.c
+                                               sendtblspclinks, &manifest, 
NULL, opt->exclude);
 
                                /* ... and pg_control after everything else. */
                                if (lstat(XLOG_CONTROL_FILE, &statbuf) != 0)
@@ -1130,16 +1104,10 @@ void
 SendBaseBackup(BaseBackupCmd *cmd)
 {
        basebackup_options opt;
-<<<<<<< HEAD:src/backend/replication/basebackup.c
-       SessionBackupState status = get_backup_status();
-
-       if (status == SESSION_BACKUP_NON_EXCLUSIVE)
-=======
        bbsink     *sink;
        SessionBackupState status = get_backup_status();
 
        if (status == SESSION_BACKUP_RUNNING)
->>>>>>> REL_16_9:src/backend/backup/basebackup.c
                ereport(ERROR,
                                
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
                                 errmsg("a backup is already in progress in 
this session")));
@@ -1179,125 +1147,8 @@ SendBaseBackup(BaseBackupCmd *cmd)
        else if (opt.compression == PG_COMPRESSION_ZSTD)
                sink = bbsink_zstd_new(sink, &opt.compression_specification);
 
-<<<<<<< HEAD:src/backend/replication/basebackup.c
-static void
-SendBackupHeader(List *tablespaces)
-{
-       StringInfoData buf;
-       ListCell   *lc;
-
-       /* Construct and send the directory information */
-       pq_beginmessage(&buf, 'T'); /* RowDescription */
-       pq_sendint16(&buf, 3);          /* 3 fields */
-
-       /* First field - spcoid */
-       pq_sendstring(&buf, "spcoid");
-       pq_sendint32(&buf, 0);          /* table oid */
-       pq_sendint16(&buf, 0);          /* attnum */
-       pq_sendint32(&buf, OIDOID); /* type oid */
-       pq_sendint16(&buf, 4);          /* typlen */
-       pq_sendint32(&buf, 0);          /* typmod */
-       pq_sendint16(&buf, 0);          /* format code */
-
-       /* Second field - spclocation */
-       pq_sendstring(&buf, "spclocation");
-       pq_sendint32(&buf, 0);
-       pq_sendint16(&buf, 0);
-       pq_sendint32(&buf, TEXTOID);
-       pq_sendint16(&buf, -1);
-       pq_sendint32(&buf, 0);
-       pq_sendint16(&buf, 0);
-
-       /* Third field - size */
-       pq_sendstring(&buf, "size");
-       pq_sendint32(&buf, 0);
-       pq_sendint16(&buf, 0);
-       pq_sendint32(&buf, INT8OID);
-       pq_sendint16(&buf, 8);
-       pq_sendint32(&buf, 0);
-       pq_sendint16(&buf, 0);
-       pq_endmessage(&buf);
-
-       foreach(lc, tablespaces)
-       {
-               tablespaceinfo *ti = lfirst(lc);
-
-               /* Send one datarow message */
-               pq_beginmessage(&buf, 'D');
-               pq_sendint16(&buf, 3);  /* number of columns */
-               if (ti->path == NULL)
-               {
-                       pq_sendint32(&buf, -1); /* Length = -1 ==> NULL */
-                       pq_sendint32(&buf, -1);
-               }
-               else
-               {
-                       Size            len;
-                       char            *link_path_to_be_sent;
-
-                       len = strlen(ti->oid);
-                       pq_sendint32(&buf, len);
-                       pq_sendbytes(&buf, ti->oid, len);
-
-                       if(ti->rpath == NULL)
-                       {
-                               /* Lop off the dbid before sending the link 
target. */
-                               char *link_path_without_dbid = 
pstrdup(ti->path);
-                               char *file_sep_before_dbid_in_link_path =
-                                               strrchr(link_path_without_dbid, 
'/');
-                               *file_sep_before_dbid_in_link_path = '\0';
-                               link_path_to_be_sent = link_path_without_dbid;
-                       }
-                       else
-                               link_path_to_be_sent = ti->path;
-                       len = strlen(link_path_to_be_sent);
-                       pq_sendint32(&buf, len);
-                       pq_sendbytes(&buf, link_path_to_be_sent, len);
-               }
-               if (ti->size >= 0)
-                       send_int8_string(&buf, ti->size / 1024);
-               else
-                       pq_sendint32(&buf, -1); /* NULL */
-
-               pq_endmessage(&buf);
-       }
-
-       /* Send a CommandComplete message */
-       pq_puttextmessage('C', "SELECT");
-
-       elogif(debug_basebackup, LOG, "basebackup header -- Sent basebackup 
header.");
-}
-
-/*
- * Send a single resultset containing just a single
- * XLogRecPtr record (in text format)
- */
-static void
-SendXlogRecPtrResult(XLogRecPtr ptr, TimeLineID tli)
-{
-       StringInfoData buf;
-       char            str[MAXFNAMELEN];
-       Size            len;
-
-       pq_beginmessage(&buf, 'T'); /* RowDescription */
-       pq_sendint16(&buf, 2);          /* 2 fields */
-
-       /* Field headers */
-       pq_sendstring(&buf, "recptr");
-       pq_sendint32(&buf, 0);          /* table oid */
-       pq_sendint16(&buf, 0);          /* attnum */
-       pq_sendint32(&buf, TEXTOID);    /* type oid */
-       pq_sendint16(&buf, -1);
-       pq_sendint32(&buf, 0);
-       pq_sendint16(&buf, 0);
-
-       pq_sendstring(&buf, "tli");
-       pq_sendint32(&buf, 0);          /* table oid */
-       pq_sendint16(&buf, 0);          /* attnum */
-=======
        /* Set up progress reporting. */
        sink = bbsink_progress_new(sink, opt.progress);
->>>>>>> REL_16_9:src/backend/backup/basebackup.c
 
        /*
         * Perform the base backup, but make sure we clean up the bbsink even if
@@ -1415,21 +1266,12 @@ sendTablespace(bbsink *sink, char *path, char *spcoid, 
bool sizeonly,
                return 0;
        }
 
-<<<<<<< HEAD:src/backend/replication/basebackup.c
-       size = _tarWriteHeader(GP_TABLESPACE_VERSION_DIRECTORY, NULL, &statbuf,
-                                                  sizeonly);
-
-       /* Send all the files in the tablespace version directory */
-       size += sendDir(pathbuf, strlen(path), sizeonly, NIL, true, manifest,
-                                       spcoid, NULL);
-=======
        size = _tarWriteHeader(sink, TABLESPACE_VERSION_DIRECTORY, NULL, 
&statbuf,
                                                   sizeonly);
 
        /* Send all the files in the tablespace version directory */
        size += sendDir(sink, pathbuf, strlen(path), sizeonly, NIL, true, 
manifest,
-                                       spcoid);
->>>>>>> REL_16_9:src/backend/backup/basebackup.c
+                                       spcoid, NULL);
 
        return size;
 }
@@ -1465,15 +1307,9 @@ match_exclude_list(char *path, HTAB *exclude)
  * GPDB: Also omit any files in the 'exclude' list.
  */
 static int64
-<<<<<<< HEAD:src/backend/replication/basebackup.c
-sendDir(const char *path, int basepathlen, bool sizeonly, List *tablespaces,
-               bool sendtblspclinks, backup_manifest_info *manifest,
-               const char *spcoid, HTAB *exclude)
-=======
 sendDir(bbsink *sink, const char *path, int basepathlen, bool sizeonly,
                List *tablespaces, bool sendtblspclinks, backup_manifest_info 
*manifest,
-               const char *spcoid)
->>>>>>> REL_16_9:src/backend/backup/basebackup.c
+               const char *spcoid, HTAB *exclude)
 {
        DIR                *dir;
        struct dirent *de;
@@ -1694,15 +1530,11 @@ sendDir(bbsink *sink, const char *path, int 
basepathlen, bool sizeonly,
                                                 errdetail("The symbolic link 
with target \"%s\" is too long. Symlink targets with length greater than %d 
characters would be truncated.", pathbuf, MAX_TARABLE_SYMLINK_PATH_LENGTH)));
                        linkpath[rllen] = '\0';
 
-<<<<<<< HEAD:src/backend/replication/basebackup.c
                        /* Lop off the dbid before sending the link target. */
                        char *file_sep_before_dbid_in_link_path = 
strrchr(linkpath, '/');
                        *file_sep_before_dbid_in_link_path = '\0';
 
-                       size += _tarWriteHeader(pathbuf + basepathlen + 1, 
linkpath,
-=======
                        size += _tarWriteHeader(sink, pathbuf + basepathlen + 
1, linkpath,
->>>>>>> REL_16_9:src/backend/backup/basebackup.c
                                                                        
&statbuf, sizeonly);
                }
                else if (S_ISDIR(statbuf.st_mode))
@@ -1746,13 +1578,8 @@ sendDir(bbsink *sink, const char *path, int basepathlen, 
bool sizeonly,
                                skip_this_dir = true;
 
                        if (!skip_this_dir)
-<<<<<<< HEAD:src/backend/replication/basebackup.c
-                               size += sendDir(pathbuf, basepathlen, sizeonly, 
tablespaces,
-                                                               
sendtblspclinks, manifest, spcoid, exclude);
-=======
                                size += sendDir(sink, pathbuf, basepathlen, 
sizeonly, tablespaces,
-                                                               
sendtblspclinks, manifest, spcoid);
->>>>>>> REL_16_9:src/backend/backup/basebackup.c
+                                                               
sendtblspclinks, manifest, spcoid, exclude);
                }
                else if (S_ISREG(statbuf.st_mode))
                {


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

Reply via email to