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 d806ba6faa3 Fix compile errors for common
d806ba6faa3 is described below

commit d806ba6faa32da9c77f40e7d144835d9e44ef5ad
Author: Jinbao Chen <[email protected]>
AuthorDate: Tue Oct 7 20:58:50 2025 +0800

    Fix compile errors for common
---
 src/common/Makefile             |  4 --
 src/common/archive.c            | 87 -----------------------------------------
 src/common/cryptohash_openssl.c |  7 ----
 src/common/exec.c               | 13 ------
 src/common/hashfn.c             |  3 --
 src/common/hmac.c               |  9 -----
 src/common/hmac_openssl.c       |  3 --
 src/common/kmgr_utils.c         | 22 +++++------
 src/common/percentrepl.c        |  1 +
 src/common/relpath.c            | 52 +++++-------------------
 src/common/sm3.c                |  6 +--
 src/port/thread.c               | 22 -----------
 12 files changed, 24 insertions(+), 205 deletions(-)

diff --git a/src/common/Makefile b/src/common/Makefile
index eaaaaf3cd49..c51fe9b610f 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -87,11 +87,7 @@ OBJS_COMMON = \
 
 ifeq ($(with_ssl),openssl)
 OBJS_COMMON += \
-<<<<<<< HEAD
        cipher_openssl.o \
-       protocol_openssl.o \
-=======
->>>>>>> REL_16_9
        cryptohash_openssl.o \
        hmac_openssl.o \
        protocol_openssl.o
diff --git a/src/common/archive.c b/src/common/archive.c
index 049c6ad1422..02b0b4d06d5 100644
--- a/src/common/archive.c
+++ b/src/common/archive.c
@@ -45,100 +45,13 @@ BuildRestoreCommand(const char *restoreCommand,
                                        const char *xlogfname,
                                        const char *lastRestartPointFname)
 {
-<<<<<<< HEAD
-       StringInfoData result;
-       const char *sp;
-#ifndef FRONTEND
-       char        contentid[12];  /* sign, 10 digits and '\0' */
-#endif
-=======
        char       *nativePath = NULL;
        char       *result;
->>>>>>> REL_16_9
 
        if (xlogpath)
        {
-<<<<<<< HEAD
-               if (*sp == '%')
-               {
-                       switch (sp[1])
-                       {
-                               case 'p':
-                                       {
-                                               char       *nativePath;
-
-                                               /* %p: relative path of target 
file */
-                                               if (xlogpath == NULL)
-                                               {
-                                                       pfree(result.data);
-                                                       return NULL;
-                                               }
-                                               sp++;
-
-                                               /*
-                                                * This needs to use a 
placeholder to not modify the
-                                                * input with the conversion 
done via
-                                                * make_native_path().
-                                                */
-                                               nativePath = pstrdup(xlogpath);
-                                               make_native_path(nativePath);
-                                               appendStringInfoString(&result,
-                                                                               
           nativePath);
-                                               pfree(nativePath);
-                                               break;
-                                       }
-                               case 'f':
-                                       /* %f: filename of desired file */
-                                       if (xlogfname == NULL)
-                                       {
-                                               pfree(result.data);
-                                               return NULL;
-                                       }
-                                       sp++;
-                                       appendStringInfoString(&result, 
xlogfname);
-                                       break;
-                               case 'r':
-                                       /* %r: filename of last restartpoint */
-                                       if (lastRestartPointFname == NULL)
-                                       {
-                                               pfree(result.data);
-                                               return NULL;
-                                       }
-                                       sp++;
-                                       appendStringInfoString(&result,
-                                                                               
   lastRestartPointFname);
-                                       break;
-#ifndef FRONTEND
-                               /* GPDB_13_MERGE_FIXME: How to set GpIdentity 
for frontend?
-                                * Discussion: 
https://postgr.es/m/[email protected]
-                                * */
-                               case 'c':
-                                       /* GPDB: %c: contentId of segment */
-                                       Assert(GpIdentity.segindex != 
UNINITIALIZED_GP_IDENTITY_VALUE);
-                                       sp++;
-                                       pg_ltoa(GpIdentity.segindex, contentid);
-                                       appendStringInfoString(&result, 
contentid);
-                                       break;
-#endif
-                               case '%':
-                                       /* convert %% to a single % */
-                                       sp++;
-                                       appendStringInfoChar(&result, *sp);
-                                       break;
-                               default:
-                                       /* otherwise treat the % as not special 
*/
-                                       appendStringInfoChar(&result, *sp);
-                                       break;
-                       }
-               }
-               else
-               {
-                       appendStringInfoChar(&result, *sp);
-               }
-=======
                nativePath = pstrdup(xlogpath);
                make_native_path(nativePath);
->>>>>>> REL_16_9
        }
 
        result = replace_percent_placeholders(restoreCommand, 
"restore_command", "frp",
diff --git a/src/common/cryptohash_openssl.c b/src/common/cryptohash_openssl.c
index 586753a4493..6a6dd778e28 100644
--- a/src/common/cryptohash_openssl.c
+++ b/src/common/cryptohash_openssl.c
@@ -51,9 +51,6 @@
 #define FREE(ptr) free(ptr)
 #endif
 
-<<<<<<< HEAD
-
-=======
 /* Set of error states */
 typedef enum pg_cryptohash_errno
 {
@@ -61,7 +58,6 @@ typedef enum pg_cryptohash_errno
        PG_CRYPTOHASH_ERROR_DEST_LEN,
        PG_CRYPTOHASH_ERROR_OPENSSL
 } pg_cryptohash_errno;
->>>>>>> REL_16_9
 
 /*
  * Internal pg_cryptohash_ctx structure.
@@ -126,16 +122,13 @@ pg_cryptohash_create(pg_cryptohash_type type)
                return NULL;
        memset(ctx, 0, sizeof(pg_cryptohash_ctx));
        ctx->type = type;
-<<<<<<< HEAD
 #ifdef OPENSSL_ALLOW_REDIRECT
        if (ctx->type == PG_SM3) {
                return ctx;
        }
 #endif
-=======
        ctx->error = PG_CRYPTOHASH_ERROR_NONE;
        ctx->errreason = NULL;
->>>>>>> REL_16_9
 
        /*
         * Initialization takes care of assigning the correct type for OpenSSL.
diff --git a/src/common/exec.c b/src/common/exec.c
index 3871cf54448..5542e0b7299 100644
--- a/src/common/exec.c
+++ b/src/common/exec.c
@@ -34,23 +34,10 @@
 #include <sys/wait.h>
 #include <unistd.h>
 
-<<<<<<< HEAD
 /* Inhibit mingw CRT's auto-globbing of command line arguments */
 #if defined(WIN32) && !defined(_MSC_VER)
 extern int _CRT_glob = 0; /* 0 turns off globbing; 1 turns it on */
-=======
-#ifdef EXEC_BACKEND
-#if defined(HAVE_SYS_PERSONALITY_H)
-#include <sys/personality.h>
-#elif defined(HAVE_SYS_PROCCTL_H)
-#include <sys/procctl.h>
-#endif
-#endif
 
-/* Inhibit mingw CRT's auto-globbing of command line arguments */
-#if defined(WIN32) && !defined(_MSC_VER)
-extern int     _CRT_glob = 0;          /* 0 turns off globbing; 1 turns it on 
*/
->>>>>>> REL_16_9
 #endif
 
 /*
diff --git a/src/common/hashfn.c b/src/common/hashfn.c
index 5d3edc9a5ac..de4af751a3d 100644
--- a/src/common/hashfn.c
+++ b/src/common/hashfn.c
@@ -40,11 +40,8 @@
 #endif
 
 #include "common/hashfn.h"
-<<<<<<< HEAD
 #include "utils/hsearch.h"
-=======
 #include "port/pg_bitutils.h"
->>>>>>> REL_16_9
 
 
 /*
diff --git a/src/common/hmac.c b/src/common/hmac.c
index 30eb1b146a3..e7a45f2105e 100644
--- a/src/common/hmac.c
+++ b/src/common/hmac.c
@@ -38,8 +38,6 @@
 #define FREE(ptr) free(ptr)
 #endif
 
-<<<<<<< HEAD
-=======
 /* Set of error states */
 typedef enum pg_hmac_errno
 {
@@ -48,7 +46,6 @@ typedef enum pg_hmac_errno
        PG_HMAC_ERROR_INTERNAL
 } pg_hmac_errno;
 
->>>>>>> REL_16_9
 /* Internal pg_hmac_ctx structure */
 struct pg_hmac_ctx
 {
@@ -265,11 +262,8 @@ pg_hmac_final(pg_hmac_ctx *ctx, uint8 *dest, size_t len)
 
        if (pg_cryptohash_final(ctx->hash, h, ctx->digest_size) < 0)
        {
-<<<<<<< HEAD
-=======
                ctx->error = PG_HMAC_ERROR_INTERNAL;
                ctx->errreason = pg_cryptohash_error(ctx->hash);
->>>>>>> REL_16_9
                FREE(h);
                return -1;
        }
@@ -280,11 +274,8 @@ pg_hmac_final(pg_hmac_ctx *ctx, uint8 *dest, size_t len)
                pg_cryptohash_update(ctx->hash, h, ctx->digest_size) < 0 ||
                pg_cryptohash_final(ctx->hash, dest, len) < 0)
        {
-<<<<<<< HEAD
-=======
                ctx->error = PG_HMAC_ERROR_INTERNAL;
                ctx->errreason = pg_cryptohash_error(ctx->hash);
->>>>>>> REL_16_9
                FREE(h);
                return -1;
        }
diff --git a/src/common/hmac_openssl.c b/src/common/hmac_openssl.c
index 92110a047fe..c2f3773a1f3 100644
--- a/src/common/hmac_openssl.c
+++ b/src/common/hmac_openssl.c
@@ -52,8 +52,6 @@
 #define FREE(ptr) free(ptr)
 #endif                                                 /* FRONTEND */
 
-<<<<<<< HEAD
-=======
 /* Set of error states */
 typedef enum pg_hmac_errno
 {
@@ -62,7 +60,6 @@ typedef enum pg_hmac_errno
        PG_HMAC_ERROR_OPENSSL
 } pg_hmac_errno;
 
->>>>>>> REL_16_9
 /* Internal pg_hmac_ctx structure */
 struct pg_hmac_ctx
 {
diff --git a/src/common/kmgr_utils.c b/src/common/kmgr_utils.c
index af668854b67..ede043d1078 100644
--- a/src/common/kmgr_utils.c
+++ b/src/common/kmgr_utils.c
@@ -228,7 +228,7 @@ kmgr_run_cluster_key_command(char *cluster_key_command, 
char *buf,
                                                if (terminal_fd == -1)
                                                {
 #ifdef FRONTEND
-                                                       pg_log_fatal("cluster 
key command referenced %%R, but --authprompt not specified");
+                                                       pg_fatal("cluster key 
command referenced %%R, but --authprompt not specified");
 #else
                                                        ereport(ERROR,
                                                                        
(errcode(ERRCODE_INTERNAL_ERROR),
@@ -264,8 +264,8 @@ kmgr_run_cluster_key_command(char *cluster_key_command, 
char *buf,
        fh = open_pipe_stream(command.data);
        if (fh == NULL)
        {
-               pg_log_fatal("could not execute command \"%s\": %m",
-                                        command.data);
+               pg_fatal("could not execute command \"%s\": %m",
+                                 command.data);
        }
 #else
        fh = OpenPipeStream(command.data, "r");
@@ -281,7 +281,7 @@ kmgr_run_cluster_key_command(char *cluster_key_command, 
char *buf,
                if (ferror(fh))
                {
 #ifdef FRONTEND
-                       pg_log_fatal("could not read from command \"%s\": %m",
+                       pg_fatal("could not read from command \"%s\": %m",
                                                 command.data);
 #else
                        ereport(ERROR,
@@ -301,7 +301,7 @@ kmgr_run_cluster_key_command(char *cluster_key_command, 
char *buf,
        if (pclose_rc == -1)
        {
 #ifdef FRONTEND
-               pg_log_fatal("could not close pipe to external command: %m");
+               pg_fatal("could not close pipe to external command: %m");
 #else
                ereport(ERROR,
                                (errcode_for_file_access(),
@@ -311,7 +311,7 @@ kmgr_run_cluster_key_command(char *cluster_key_command, 
char *buf,
        else if (pclose_rc != 0)
        {
 #ifdef FRONTEND
-               pg_log_fatal("command \"%s\" failed", command.data);
+               pg_fatal("command \"%s\" failed", command.data);
 #else
                ereport(ERROR,
                                (errcode_for_file_access(),
@@ -424,10 +424,10 @@ read_wrapped_data_key(const char *cryptoKeyDir, uint32 
id, unsigned char **key_p
                                                path)));
 #else
        if ((fd = open(path, O_RDONLY | PG_BINARY, 0)) == -1)
-               pg_log_fatal("could not open file \"%s\" for reading: %m",
+               pg_fatal("could not open file \"%s\" for reading: %m",
                                         path);
        else if (fstat(fd, &st))
-               pg_log_fatal("could not stat file \"%s\": %m",
+               pg_fatal("could not stat file \"%s\": %m",
                                         path);
 #endif
 
@@ -450,7 +450,7 @@ read_wrapped_data_key(const char *cryptoKeyDir, uint32 id, 
unsigned char **key_p
                                        (errcode_for_file_access(),
                                         errmsg("could not read file \"%s\": 
%m", path)));
 #else
-                       pg_log_fatal("could not read file \"%s\": %m", path);
+                       pg_fatal("could not read file \"%s\": %m", path);
 #endif
                }
                else
@@ -461,7 +461,7 @@ read_wrapped_data_key(const char *cryptoKeyDir, uint32 id, 
unsigned char **key_p
                                         errmsg("could not read file \"%s\": 
read %d of %u",
                                                        path, r, *key_len)));
 #else
-                       pg_log_fatal("could not read file \"%s\": read %d of 
%u",
+                       pg_fatal("could not read file \"%s\": read %d of %u",
                                                 path, r, *key_len);
 #endif
                }
@@ -479,6 +479,6 @@ read_wrapped_data_key(const char *cryptoKeyDir, uint32 id, 
unsigned char **key_p
                                                path)));
 #else
        if (close(fd) != 0)
-               pg_log_fatal("could not close file \"%s\": %m", path);
+               pg_fatal("could not close file \"%s\": %m", path);
 #endif
 }
diff --git a/src/common/percentrepl.c b/src/common/percentrepl.c
index 5c5a4fa0aa2..f22dcdf3efc 100644
--- a/src/common/percentrepl.c
+++ b/src/common/percentrepl.c
@@ -20,6 +20,7 @@
 #include "common/logging.h"
 #endif
 
+#include "cdb/cdbvars.h"
 #include "common/percentrepl.h"
 #include "lib/stringinfo.h"
 #include "postmaster/postmaster.h"
diff --git a/src/common/relpath.c b/src/common/relpath.c
index 9f9a817f9e6..3c923969acd 100644
--- a/src/common/relpath.c
+++ b/src/common/relpath.c
@@ -124,11 +124,7 @@ GetDatabasePath(Oid dbOid, Oid spcOid)
        {
                /* All other tablespaces are accessed via symlinks */
                return psprintf("pg_tblspc/%u/%s/%u",
-<<<<<<< HEAD
-                                               spcNode, 
GP_TABLESPACE_VERSION_DIRECTORY, dbNode);
-=======
-                                               spcOid, 
TABLESPACE_VERSION_DIRECTORY, dbOid);
->>>>>>> REL_16_9
+                                               spcOid, 
GP_TABLESPACE_VERSION_DIRECTORY, dbOid);
        }
 }
 
@@ -182,21 +178,12 @@ GetRelationPath(Oid dbOid, Oid spcOid, RelFileNumber 
relNumber,
                else
                {
                        if (forkNumber != MAIN_FORKNUM)
-<<<<<<< HEAD
                                path = psprintf("base/%u/t_%u_%s",
-                                                               dbNode, relNode,
+                                                               dbOid, 
relNumber,
                                                                
forkNames[forkNumber]);
                        else
                                path = psprintf("base/%u/t_%u",
-                                                               dbNode, 
relNode);
-=======
-                               path = psprintf("base/%u/t%d_%u_%s",
-                                                               dbOid, 
backendId, relNumber,
-                                                               
forkNames[forkNumber]);
-                       else
-                               path = psprintf("base/%u/t%d_%u",
-                                                               dbOid, 
backendId, relNumber);
->>>>>>> REL_16_9
+                                                               dbOid, 
relNumber);
                }
        }
        else
@@ -206,46 +193,25 @@ GetRelationPath(Oid dbOid, Oid spcOid, RelFileNumber 
relNumber,
                {
                        if (forkNumber != MAIN_FORKNUM)
                                path = psprintf("pg_tblspc/%u/%s/%u/%u_%s",
-<<<<<<< HEAD
-                                                               spcNode, 
GP_TABLESPACE_VERSION_DIRECTORY,
-                                                               dbNode, relNode,
-                                                               
forkNames[forkNumber]);
-                       else
-                               path = psprintf("pg_tblspc/%u/%s/%u/%u",
-                                                               spcNode, 
GP_TABLESPACE_VERSION_DIRECTORY,
-                                                               dbNode, 
relNode);
-=======
-                                                               spcOid, 
TABLESPACE_VERSION_DIRECTORY,
+                                                               spcOid, 
GP_TABLESPACE_VERSION_DIRECTORY,
                                                                dbOid, 
relNumber,
                                                                
forkNames[forkNumber]);
                        else
                                path = psprintf("pg_tblspc/%u/%s/%u/%u",
-                                                               spcOid, 
TABLESPACE_VERSION_DIRECTORY,
+                                                               spcOid, 
GP_TABLESPACE_VERSION_DIRECTORY,
                                                                dbOid, 
relNumber);
->>>>>>> REL_16_9
                }
                else
                {
                        if (forkNumber != MAIN_FORKNUM)
-<<<<<<< HEAD
                                path = psprintf("pg_tblspc/%u/%s/%u/t_%u_%s",
-                                                               spcNode, 
GP_TABLESPACE_VERSION_DIRECTORY,
-                                                               dbNode, relNode,
+                                                               spcOid, 
GP_TABLESPACE_VERSION_DIRECTORY,
+                                                               dbOid, 
relNumber,
                                                                
forkNames[forkNumber]);
                        else
                                path = psprintf("pg_tblspc/%u/%s/%u/t_%u",
-                                                               spcNode, 
GP_TABLESPACE_VERSION_DIRECTORY,
-                                                               dbNode, 
relNode);
-=======
-                               path = psprintf("pg_tblspc/%u/%s/%u/t%d_%u_%s",
-                                                               spcOid, 
TABLESPACE_VERSION_DIRECTORY,
-                                                               dbOid, 
backendId, relNumber,
-                                                               
forkNames[forkNumber]);
-                       else
-                               path = psprintf("pg_tblspc/%u/%s/%u/t%d_%u",
-                                                               spcOid, 
TABLESPACE_VERSION_DIRECTORY,
-                                                               dbOid, 
backendId, relNumber);
->>>>>>> REL_16_9
+                                                               spcOid, 
GP_TABLESPACE_VERSION_DIRECTORY,
+                                                               dbOid, 
relNumber);
                }
        }
        return path;
diff --git a/src/common/sm3.c b/src/common/sm3.c
index e3c8dc15039..a1baabffbbb 100644
--- a/src/common/sm3.c
+++ b/src/common/sm3.c
@@ -81,7 +81,7 @@ SM3_Transform(pg_sm3_ctx *context, const uint8 *data)
        uint32_t W[68], W_B[64];
        int             j;
 
-       uint32_t tmp, *tmp_data;
+       uint32_t tmp2, *tmp_data;
        uint32_t SS1, SS2, TT1, TT2;
        uint32_t T;
 
@@ -101,8 +101,8 @@ SM3_Transform(pg_sm3_ctx *context, const uint8 *data)
        }
 
        for (; j <= 67; j++) {
-               tmp = W[j - 16] ^ W[j - 9] ^ rol32(W[j - 3], 15);
-               W[j] = SM3_P1(tmp) ^ (rol32(W[j - 13], 7)) ^ W[j - 6];
+               tmp2 = W[j - 16] ^ W[j - 9] ^ rol32(W[j - 3], 15);
+               W[j] = SM3_P1(tmp2) ^ (rol32(W[j - 13], 7)) ^ W[j - 6];
        }
 
        for (j = 0; j < 64; j++) {
diff --git a/src/port/thread.c b/src/port/thread.c
index 17934a5ac2a..375c89b2974 100644
--- a/src/port/thread.c
+++ b/src/port/thread.c
@@ -23,24 +23,6 @@
  */
 
 #ifndef WIN32
-<<<<<<< HEAD
-int
-pqGetpwuid(uid_t uid, struct passwd *resultbuf, char *buffer,
-                  size_t buflen, struct passwd **result)
-{
-#if defined(ENABLE_THREAD_SAFETY) && defined(HAVE_GETPWUID_R)
-       return getpwuid_r(uid, resultbuf, buffer, buflen, result);
-#else
-       /* no getpwuid_r() available, just use getpwuid() */
-       errno = 0;
-       *result = getpwuid(uid);
-       /* paranoia: ensure we return zero on success */
-       return (*result == NULL) ? errno : 0;
-#endif
-}
-#endif
-=======
->>>>>>> REL_16_9
 
 /*
  * pg_get_user_name - get the name of the user with the given ID
@@ -52,14 +34,10 @@ pqGetpwuid(uid_t uid, struct passwd *resultbuf, char 
*buffer,
 bool
 pg_get_user_name(uid_t user_id, char *buffer, size_t buflen)
 {
-<<<<<<< HEAD
-#if defined(ENABLE_THREAD_SAFETY) && defined(HAVE_GETHOSTBYNAME_R)
-=======
        char            pwdbuf[BUFSIZ];
        struct passwd pwdstr;
        struct passwd *pw = NULL;
        int                     pwerr;
->>>>>>> REL_16_9
 
        pwerr = getpwuid_r(user_id, &pwdstr, pwdbuf, sizeof(pwdbuf), &pw);
        if (pw != NULL)


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

Reply via email to