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 752460093c6 Fix conflicts for postmaster
752460093c6 is described below

commit 752460093c6bfdbf244049bdce48f48cde3784fa
Author: Jinbao Chen <chenjinbao1...@gmail.com>
AuthorDate: Fri Jul 25 15:22:02 2025 +0800

    Fix conflicts for postmaster
---
 src/backend/postmaster/autovacuum.c |  33 -------
 src/backend/postmaster/interrupt.c  |   3 -
 src/backend/postmaster/pgarch.c     | 106 ---------------------
 src/backend/postmaster/postmaster.c | 144 +----------------------------
 src/backend/postmaster/syslogger.c  | 180 ++----------------------------------
 src/common/percentrepl.c            |   4 +
 6 files changed, 18 insertions(+), 452 deletions(-)

diff --git a/src/backend/postmaster/autovacuum.c 
b/src/backend/postmaster/autovacuum.c
index ac32a30baf8..7372a51a373 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -125,10 +125,7 @@
 #include "catalog/namespace.h"
 #include "catalog/pg_am.h"
 #include "catalog/pg_database.h"
-<<<<<<< HEAD
-=======
 #include "catalog/pg_namespace.h"
->>>>>>> REL_16_9
 #include "commands/dbcommands.h"
 #include "commands/vacuum.h"
 #include "lib/ilist.h"
@@ -185,14 +182,7 @@ int                        
autovacuum_multixact_freeze_max_age;
 double         autovacuum_vac_cost_delay;
 int                    autovacuum_vac_cost_limit;
 
-<<<<<<< HEAD
-int                    Log_autovacuum_min_duration = 0;
-
-/* how long to keep pgstat data in the launcher, in milliseconds */
-#define STATS_READ_DELAY 1000
-=======
 int                    Log_autovacuum_min_duration = 600000;
->>>>>>> REL_16_9
 
 /* the minimum allowed time between two awakenings of the launcher */
 #define MIN_AUTOVAC_SLEEPTIME 100.0 /* milliseconds */
@@ -2237,15 +2227,11 @@ do_autovacuum(void)
                bool            wraparound;
 
                if (classForm->relkind != RELKIND_RELATION &&
-<<<<<<< HEAD
                        classForm->relkind != RELKIND_DIRECTORY_TABLE &&
                        classForm->relkind != RELKIND_MATVIEW &&
                        classForm->relkind != RELKIND_AOSEGMENTS &&
                        classForm->relkind != RELKIND_AOBLOCKDIR &&
                        classForm->relkind != RELKIND_AOVISIMAP)
-=======
-                       classForm->relkind != RELKIND_MATVIEW)
->>>>>>> REL_16_9
                        continue;
 
                relid = classForm->oid;
@@ -2955,15 +2941,11 @@ extract_autovac_opts(HeapTuple tup, TupleDesc 
pg_class_desc)
 
        Assert(((Form_pg_class) GETSTRUCT(tup))->relkind == RELKIND_RELATION ||
                   ((Form_pg_class) GETSTRUCT(tup))->relkind == RELKIND_MATVIEW 
||
-<<<<<<< HEAD
                   ((Form_pg_class) GETSTRUCT(tup))->relkind == 
RELKIND_DIRECTORY_TABLE ||
                   ((Form_pg_class) GETSTRUCT(tup))->relkind == 
RELKIND_TOASTVALUE ||
                   ((Form_pg_class) GETSTRUCT(tup))->relkind == 
RELKIND_AOSEGMENTS ||
                   ((Form_pg_class) GETSTRUCT(tup))->relkind == 
RELKIND_AOBLOCKDIR ||
                   ((Form_pg_class) GETSTRUCT(tup))->relkind == 
RELKIND_AOVISIMAP);
-=======
-                  ((Form_pg_class) GETSTRUCT(tup))->relkind == 
RELKIND_TOASTVALUE);
->>>>>>> REL_16_9
 
        relam = ((Form_pg_class) GETSTRUCT(tup))->relam;
        tam = GetTableAmRoutineByAmId(relam);
@@ -3104,16 +3086,11 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
                tab->at_params.multixact_freeze_table_age = 
multixact_freeze_table_age;
                tab->at_params.is_wraparound = wraparound;
                tab->at_params.log_min_duration = log_min_duration;
-<<<<<<< HEAD
                tab->at_params.auto_stats = false;
-               tab->at_vacuum_cost_limit = vac_cost_limit;
-               tab->at_vacuum_cost_delay = vac_cost_delay;
-=======
                tab->at_storage_param_vac_cost_limit = avopts ?
                        avopts->vacuum_cost_limit : 0;
                tab->at_storage_param_vac_cost_delay = avopts ?
                        avopts->vacuum_cost_delay : -1;
->>>>>>> REL_16_9
                tab->at_relname = NULL;
                tab->at_nspname = NULL;
                tab->at_datname = NULL;
@@ -3239,19 +3216,13 @@ relation_needs_vacanalyze(Oid relid,
        TransactionId xidForceLimit;
        MultiXactId multiForceLimit;
 
-<<<<<<< HEAD
        /*
         * We don't need to hold AutovacuumLock here, since it should be 
read-only in the worker itself
         * once the MyWorkerInfo gets set, all the workers only care about its 
own value.
         */
        Assert(MyWorkerInfo);
-
-       AssertArg(classForm != NULL);
-       AssertArg(OidIsValid(relid));
-=======
        Assert(classForm != NULL);
        Assert(OidIsValid(relid));
->>>>>>> REL_16_9
 
        /*
         * Determine vacuum/analyze equation parameters.  We have two possible
@@ -3431,15 +3402,12 @@ autovacuum_do_vac_analyze(autovac_table *tab, 
BufferAccessStrategy bstrategy)
        rel = makeVacuumRelation(rangevar, tab->at_relid, NIL);
        rel_list = list_make1(rel);
 
-<<<<<<< HEAD
 #ifdef FAULT_INJECTOR
        FaultInjector_InjectFaultIfSet(
                "auto_vac_worker_after_report_activity", DDLNotSpecified,
                "", tab->at_relname);
 #endif
 
-       vacuum(rel_list, &tab->at_params, bstrategy, true);
-=======
        vac_context = AllocSetContextCreate(CurrentMemoryContext,
                                                                                
"Vacuum",
                                                                                
ALLOCSET_DEFAULT_SIZES);
@@ -3447,7 +3415,6 @@ autovacuum_do_vac_analyze(autovac_table *tab, 
BufferAccessStrategy bstrategy)
        vacuum(rel_list, &tab->at_params, bstrategy, vac_context, true);
 
        MemoryContextDelete(vac_context);
->>>>>>> REL_16_9
 }
 
 /*
diff --git a/src/backend/postmaster/interrupt.c 
b/src/backend/postmaster/interrupt.c
index 1b39878118a..54c39e5395c 100644
--- a/src/backend/postmaster/interrupt.c
+++ b/src/backend/postmaster/interrupt.c
@@ -22,11 +22,8 @@
 #include "storage/latch.h"
 #include "storage/procsignal.h"
 #include "utils/guc.h"
-<<<<<<< HEAD
 #include "utils/faultinjector.h"
-=======
 #include "utils/memutils.h"
->>>>>>> REL_16_9
 
 volatile sig_atomic_t ConfigReloadPending = false;
 volatile sig_atomic_t ShutdownRequestPending = false;
diff --git a/src/backend/postmaster/pgarch.c b/src/backend/postmaster/pgarch.c
index 4d6c489b16f..5f3f50b4df2 100644
--- a/src/backend/postmaster/pgarch.c
+++ b/src/backend/postmaster/pgarch.c
@@ -31,11 +31,8 @@
 
 #include "access/xlog.h"
 #include "access/xlog_internal.h"
-<<<<<<< HEAD
-=======
 #include "archive/archive_module.h"
 #include "archive/shell_archive.h"
->>>>>>> REL_16_9
 #include "lib/binaryheap.h"
 #include "libpq/pqsignal.h"
 #include "pgstat.h"
@@ -91,12 +88,7 @@ typedef struct PgArchData
        int                     pgprocno;               /* pgprocno of archiver 
process */
 
        /*
-<<<<<<< HEAD
-        * Forces a directory scan in pgarch_readyXlog().  Protected by
-        * arch_lck.
-=======
         * Forces a directory scan in pgarch_readyXlog().  Protected by 
arch_lck.
->>>>>>> REL_16_9
         */
        bool            force_dir_scan;
 
@@ -183,13 +175,9 @@ static bool pgarch_readyXlog(char *xlog);
 static void pgarch_archiveDone(char *xlog);
 static void pgarch_die(int code, Datum arg);
 static void HandlePgArchInterrupts(void);
-<<<<<<< HEAD
-static int ready_file_comparator(Datum a, Datum b, void *arg);
-=======
 static int     ready_file_comparator(Datum a, Datum b, void *arg);
 static void LoadArchiveLibrary(void);
 static void pgarch_call_module_shutdown_cb(int code, Datum arg);
->>>>>>> REL_16_9
 
 /* Report shared memory space needed by PgArchShmemInit */
 Size
@@ -294,12 +282,9 @@ PgArchiverMain(void)
        arch_files->arch_heap = 
binaryheap_allocate(NUM_FILES_PER_DIRECTORY_SCAN,
                                                                                
                ready_file_comparator, NULL);
 
-<<<<<<< HEAD
-=======
        /* Load the archive_library. */
        LoadArchiveLibrary();
 
->>>>>>> REL_16_9
        pgarch_MainLoop();
 
        proc_exit(0);
@@ -550,72 +535,8 @@ pgarch_archiveXlog(char *xlog)
        char            activitymsg[MAXFNAMELEN + 16];
        bool            ret;
 
-       char            contentid[12];  /* sign, 10 digits and '\0' */
-
        snprintf(pathname, MAXPGPATH, XLOGDIR "/%s", xlog);
 
-<<<<<<< HEAD
-       /*
-        * construct the command to be executed
-        */
-       dp = xlogarchcmd;
-       endp = xlogarchcmd + MAXPGPATH - 1;
-       *endp = '\0';
-
-       for (sp = XLogArchiveCommand; *sp; sp++)
-       {
-               if (*sp == '%')
-               {
-                       switch (sp[1])
-                       {
-                               case 'p':
-                                       /* %p: relative path of source file */
-                                       sp++;
-                                       strlcpy(dp, pathname, endp - dp);
-                                       make_native_path(dp);
-                                       dp += strlen(dp);
-                                       break;
-                               case 'f':
-                                       /* %f: filename of source file */
-                                       sp++;
-                                       strlcpy(dp, xlog, endp - dp);
-                                       dp += strlen(dp);
-                                       break;
-                               case 'c':
-                                       /* GPDB: %c: contentId of segment */
-                                       Assert(GpIdentity.segindex != 
UNINITIALIZED_GP_IDENTITY_VALUE);
-                                       sp++;
-                                       pg_ltoa(GpIdentity.segindex, contentid);
-                                       strlcpy(dp, contentid, endp - dp);
-                                       dp += strlen(dp);
-                                       break;
-                               case '%':
-                                       /* convert %% to a single % */
-                                       sp++;
-                                       if (dp < endp)
-                                               *dp++ = *sp;
-                                       break;
-                               default:
-                                       /* otherwise treat the % as not special 
*/
-                                       if (dp < endp)
-                                               *dp++ = *sp;
-                                       break;
-                       }
-               }
-               else
-               {
-                       if (dp < endp)
-                               *dp++ = *sp;
-               }
-       }
-       *dp = '\0';
-
-       ereport(DEBUG3,
-                       (errmsg_internal("executing archive command \"%s\"",
-                                                        xlogarchcmd)));
-
-=======
->>>>>>> REL_16_9
        /* Report archive activity in PS display */
        snprintf(activitymsg, sizeof(activitymsg), "archiving %s", xlog);
        set_ps_display(activitymsg);
@@ -674,15 +595,6 @@ pgarch_readyXlog(char *xlog)
 
        /*
         * If we still have stored file names from the previous directory scan,
-<<<<<<< HEAD
-        * try to return one of those.  We check to make sure the status file
-        * is still present, as the archive_command for a previous file may
-        * have already marked it done.
-        */
-       while (arch_files->arch_files_size > 0)
-       {
-               struct stat     st;
-=======
         * try to return one of those.  We check to make sure the status file is
         * still present, as the archive_command for a previous file may have
         * already marked it done.
@@ -690,7 +602,6 @@ pgarch_readyXlog(char *xlog)
        while (arch_files->arch_files_size > 0)
        {
                struct stat st;
->>>>>>> REL_16_9
                char            status_file[MAXPGPATH];
                char       *arch_file;
 
@@ -760,13 +671,8 @@ pgarch_readyXlog(char *xlog)
                                                                           
CStringGetDatum(basename), NULL) > 0)
                {
                        /*
-<<<<<<< HEAD
-                        * Remove the lowest priority file and add the current 
one to
-                        * the heap.
-=======
                         * Remove the lowest priority file and add the current 
one to the
                         * heap.
->>>>>>> REL_16_9
                         */
                        arch_file = 
DatumGetCString(binaryheap_remove_first(arch_files->arch_heap));
                        strcpy(arch_file, basename);
@@ -787,13 +693,8 @@ pgarch_readyXlog(char *xlog)
                binaryheap_build(arch_files->arch_heap);
 
        /*
-<<<<<<< HEAD
-        * Fill arch_files array with the files to archive in ascending order
-        * of priority.
-=======
         * Fill arch_files array with the files to archive in ascending order of
         * priority.
->>>>>>> REL_16_9
         */
        arch_files->arch_files_size = arch_files->arch_heap->bh_size;
        for (int i = 0; i < arch_files->arch_files_size; i++)
@@ -817,17 +718,10 @@ pgarch_readyXlog(char *xlog)
 static int
 ready_file_comparator(Datum a, Datum b, void *arg)
 {
-<<<<<<< HEAD
-       char *a_str = DatumGetCString(a);
-       char *b_str = DatumGetCString(b);
-       bool a_history = IsTLHistoryFileName(a_str);
-       bool b_history = IsTLHistoryFileName(b_str);
-=======
        char       *a_str = DatumGetCString(a);
        char       *b_str = DatumGetCString(b);
        bool            a_history = IsTLHistoryFileName(a_str);
        bool            b_history = IsTLHistoryFileName(b_str);
->>>>>>> REL_16_9
 
        /* Timeline history files always have the highest priority. */
        if (a_history != b_history)
diff --git a/src/backend/postmaster/postmaster.c 
b/src/backend/postmaster/postmaster.c
index c79d003c174..245e7c75866 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -32,13 +32,9 @@
  *       clients.
  *
  *
-<<<<<<< HEAD
  * Portions Copyright (c) 2005-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
  *
  *
@@ -238,7 +234,6 @@ char           *Unix_socket_directories;
 char      *ListenAddresses;
 
 /*
-<<<<<<< HEAD
  * The interconnect address. We assume the interconnect is the address
  * in gp_segment_configuration. And it's never changed at runtime.
  */
@@ -252,7 +247,6 @@ char           *interconnect_address = NULL;
  * "if there are <= ReservedBackends connections available, only superusers
  * can make new connections" --- pre-existing superuser connections don't
  * count against the limit.
-=======
  * SuperuserReservedConnections is the number of backends reserved for
  * superuser use, and ReservedConnections is the number of backends reserved
  * for use by roles with privileges of the pg_use_reserved_connections
@@ -269,7 +263,6 @@ char           *interconnect_address = NULL;
  * roles with privileges of pg_use_reserved_connections can make new
  * connections.  Note that pre-existing superuser and
  * pg_use_reserved_connections connections don't count against the limits.
->>>>>>> REL_16_9
  */
 int                    SuperuserReservedConnections;
 int                    ReservedConnections;
@@ -293,12 +286,9 @@ bool               enable_bonjour = false;
 char      *bonjour_name;
 bool           restart_after_crash = true;
 bool           remove_temp_files_after_crash = true;
-<<<<<<< HEAD
 bool           enable_password_profile = true;
-=======
 bool           send_abort_for_crash = false;
 bool           send_abort_for_kill = false;
->>>>>>> REL_16_9
 
 /* Hook for plugins to start background workers */
 start_bgworkers_hook_type start_bgworkers_hook = NULL;
@@ -315,13 +305,8 @@ static pid_t StartupPID = 0,
                        WalReceiverPID = 0,
                        AutoVacPID = 0,
                        PgArchPID = 0,
-<<<<<<< HEAD
-                       PgStatPID = 0,
                        SysLoggerPID = 0,
                        LoginMonitorPID = 0;
-=======
-                       SysLoggerPID = 0;
->>>>>>> REL_16_9
 
 /* Startup process's status */
 typedef enum
@@ -556,12 +541,8 @@ static int ServerLoop(void);
 static int     BackendStartup(Port *port);
 static int     ProcessStartupPacket(Port *port, bool ssl_done, bool gss_done);
 static void SendNegotiateProtocolVersion(List *unrecognized_protocol_options);
-<<<<<<< HEAD
 static void processCancelRequest(Port *port, void *pkt, MsgType code);
 static int     initMasks(fd_set *rmask);
-=======
-static void processCancelRequest(Port *port, void *pkt);
->>>>>>> REL_16_9
 static void report_fork_failure_to_client(Port *port, int errnum);
 static CAC_state canAcceptConnections(int backend_type);
 static bool RandomCancelKey(int32 *cancel_key);
@@ -792,7 +773,6 @@ PostmasterMain(int argc, char *argv[])
        /*
         * Set up signal handlers for the postmaster process.
         *
-<<<<<<< HEAD
         * In the postmaster, we use pqsignal_pm() rather than pqsignal() (which
         * is used by all child processes and client processes).  That has a
         * couple of special behaviors:
@@ -813,8 +793,6 @@ PostmasterMain(int argc, char *argv[])
         * flag.  We expect children to set up their own handlers before
         * unblocking signals.
         *
-=======
->>>>>>> REL_16_9
         * CAUTION: when changing this list, check for side-effects on the 
signal
         * handling setup of child processes.  See tcop/postgres.c,
         * bootstrap/bootstrap.c, postmaster/bgwriter.c, postmaster/walwriter.c,
@@ -872,11 +850,7 @@ PostmasterMain(int argc, char *argv[])
         * tcop/postgres.c (the option sets should not conflict) and with the
         * common help() function in main/main.c.
         */
-<<<<<<< HEAD
-       while ((opt = getopt(argc, argv, 
"B:bc:C:D:d:EeFf:h:ijk:lMmN:nOo:Pp:r:R:S:sTt:W:-:")) != -1)
-=======
-       while ((opt = getopt(argc, argv, 
"B:bC:c:D:d:EeFf:h:ijk:lN:OPp:r:S:sTt:W:-:")) != -1)
->>>>>>> REL_16_9
+       while ((opt = getopt(argc, argv, 
"B:bc:C:D:d:EeFf:h:ijk:lMmN:Oo:Pp:r:R:S:sTt:W:-:")) != -1)
        {
                switch (opt)
                {
@@ -1158,9 +1132,7 @@ PostmasterMain(int argc, char *argv[])
      * non-leaf QEs don't necessarily access the database (some are used only
      * for sorting, hashing, etc); so again the number of buffers need not be
      * in proportion to the number of connections.
-        */
-<<<<<<< HEAD
-       if (NBuffers < 16)
+        */if (NBuffers < 16)
        {
                /*
                 * Do not accept -B so small that backends are likely to starve 
for
@@ -1177,10 +1149,7 @@ PostmasterMain(int argc, char *argv[])
         * max_connections. Hence, in gpdb below check is modified from 
upstream to
         * allow equal setting.
         */
-       if (ReservedBackends > MaxConnections)
-=======
        if (SuperuserReservedConnections + ReservedConnections >= 
MaxConnections)
->>>>>>> REL_16_9
        {
                write_stderr("%s: superuser_reserved_connections (%d) plus 
reserved_connections (%d) must be less than max_connections (%d)\n",
                                         progname,
@@ -1289,7 +1258,6 @@ PostmasterMain(int argc, char *argv[])
        LocalProcessControlFile(false);
 
        /*
-<<<<<<< HEAD
         * CDB: gpdb auxilary process like fts probe, dtx recovery process is
         * essential, we need to load them ahead of custom shared preload 
libraries
         * to avoid exceeding max_worker_processes.
@@ -1297,14 +1265,8 @@ PostmasterMain(int argc, char *argv[])
        load_auxiliary_libraries();
 
        /*
-        * Register the apply launcher.  Since it registers a background worker,
-        * it needs to be called before InitializeMaxBackends(), and it's 
probably
-        * a good idea to call it before any modules had chance to take the
-        * background worker slots.
-=======
         * Register the apply launcher.  It's probably a good idea to call this
         * before any modules had a chance to take the background worker slots.
->>>>>>> REL_16_9
         */
        ApplyLauncherRegister();
 
@@ -1336,17 +1298,7 @@ PostmasterMain(int argc, char *argv[])
        InitializeMaxBackends();
 
        /*
-<<<<<<< HEAD
-        * Now that modules have been loaded, we can process any custom resource
-        * managers specified in the wal_consistency_checking GUC.
-        */
-       InitializeWalConsistencyChecking();
-
-       /*
-        * Set up shared memory and semaphores.
-=======
         * Give preloaded libraries a chance to request additional shared 
memory.
->>>>>>> REL_16_9
         */
        process_shmem_requests();
 
@@ -1735,13 +1687,8 @@ PostmasterMain(int argc, char *argv[])
                 * since there is no way to connect to the database in this 
case.
                 */
                ereport(FATAL,
-<<<<<<< HEAD
                                (errcode(ERRCODE_CONFIG_FILE_ERROR),
                                 (errmsg("could not load pg_hba.conf"))));
-=======
-               /* translator: %s is a configuration file */
-                               (errmsg("could not load %s", HbaFileName)));
->>>>>>> REL_16_9
        }
        if (!load_ident())
        {
@@ -2331,7 +2278,6 @@ ServerLoop(void)
 }
 
 /*
-<<<<<<< HEAD
  * Initialise the masks for select() for the ports we are listening on.
  * Return the number of sockets to listen on.
  */
@@ -2384,8 +2330,6 @@ GetMirrorReadyFlag(void)
 }
 
 /*
-=======
->>>>>>> REL_16_9
  * Read a client's startup packet and do something according to it.
  *
  * Returns STATUS_OK or STATUS_ERROR, or might call ereport(FATAL) and
@@ -2483,18 +2427,7 @@ ProcessStartupPacket(Port *port, bool ssl_done, bool 
gss_done)
 
        if (proto == CANCEL_REQUEST_CODE || proto == FINISH_REQUEST_CODE)
        {
-<<<<<<< HEAD
                processCancelRequest(port, buf, proto);
-=======
-               if (len != sizeof(CancelRequestPacket))
-               {
-                       ereport(COMMERROR,
-                                       (errcode(ERRCODE_PROTOCOL_VIOLATION),
-                                        errmsg("invalid length of startup 
packet")));
-                       return STATUS_ERROR;
-               }
-               processCancelRequest(port, buf);
->>>>>>> REL_16_9
                /* Not really an error, but we don't want to proceed further */
                return STATUS_ERROR;
        }
@@ -2921,7 +2854,6 @@ retry1:
                                        (errcode(ERRCODE_TOO_MANY_CONNECTIONS),
                                         errmsg("sorry, too many clients 
already")));
                        break;
-<<<<<<< HEAD
                case CAC_MIRROR_READY:
                        if (am_ftshandler || am_faulthandler)
                        {
@@ -2956,8 +2888,6 @@ retry1:
                case CAC_SUPERUSER:
                        /* OK for now, will check in InitPostgres */
                        break;
-=======
->>>>>>> REL_16_9
                case CAC_OK:
                        break;
        }
@@ -3324,8 +3254,6 @@ handle_pm_pmsignal_signal(SIGNAL_ARGS)
 {
        int                     save_errno = errno;
 
-<<<<<<< HEAD
-=======
        pending_pm_pmsignal = true;
        SetLatch(MyLatch);
 
@@ -3357,7 +3285,6 @@ process_pm_reload_request(void)
        ereport(DEBUG2,
                        (errmsg_internal("postmaster received reload request 
signal")));
 
->>>>>>> REL_16_9
        if (Shutdown <= SmartShutdown)
        {
                ereport(LOG,
@@ -3380,13 +3307,8 @@ process_pm_reload_request(void)
                        signal_child(PgArchPID, SIGHUP);
                if (SysLoggerPID != 0)
                        signal_child(SysLoggerPID, SIGHUP);
-<<<<<<< HEAD
-               if (PgStatPID != 0)
-                       signal_child(PgStatPID, SIGHUP);
                if (enable_password_profile && LoginMonitorPID != 0)
                        signal_child(LoginMonitorPID, SIGHUP);
-=======
->>>>>>> REL_16_9
 
                /* Reload authentication config files too */
                if (!load_hba())
@@ -3420,11 +3342,6 @@ process_pm_reload_request(void)
                write_nondefault_variables(PGC_SIGHUP);
 #endif
        }
-<<<<<<< HEAD
-
-       errno = save_errno;
-=======
->>>>>>> REL_16_9
 }
 
 /*
@@ -3436,13 +3353,6 @@ handle_pm_shutdown_request_signal(SIGNAL_ARGS)
 {
        int                     save_errno = errno;
 
-<<<<<<< HEAD
-       ereport(DEBUG2,
-                       (errmsg_internal("postmaster received signal %d",
-                                                        postgres_signal_arg)));
-
-=======
->>>>>>> REL_16_9
        switch (postgres_signal_arg)
        {
                case SIGTERM:
@@ -3617,8 +3527,7 @@ process_pm_shutdown_request(void)
        }
 }
 
-<<<<<<< HEAD
-=======
+
 static void
 handle_pm_child_exit_signal(SIGNAL_ARGS)
 {
@@ -3627,7 +3536,6 @@ handle_pm_child_exit_signal(SIGNAL_ARGS)
        pending_pm_child_exit = true;
        SetLatch(MyLatch);
 
->>>>>>> REL_16_9
        errno = save_errno;
 }
 
@@ -3640,11 +3548,8 @@ process_pm_child_exit(void)
        int                     pid;                    /* process id of dead 
child process */
        int                     exitstatus;             /* its exit status */
 
-<<<<<<< HEAD
-=======
        pending_pm_child_exit = false;
 
->>>>>>> REL_16_9
        ereport(DEBUG4,
                        (errmsg_internal("reaping dead processes")));
 
@@ -3761,13 +3666,8 @@ process_pm_child_exit(void)
                                AutoVacPID = StartAutoVacLauncher();
                        if (PgArchStartupAllowed() && PgArchPID == 0)
                                PgArchPID = StartArchiver();
-<<<<<<< HEAD
-                       if (PgStatPID == 0)
-                               PgStatPID = pgstat_start();
                        if (enable_password_profile && LoginMonitorPID == 0)
                                LoginMonitorPID = StartLoginMonitorLauncher();
-=======
->>>>>>> REL_16_9
 
                        /* workers may be scheduled to start now */
                        maybe_start_bgworkers();
@@ -3973,11 +3873,6 @@ process_pm_child_exit(void)
         * or actions to make.
         */
        PostmasterStateMachine();
-<<<<<<< HEAD
-
-       errno = save_errno;
-=======
->>>>>>> REL_16_9
 }
 
 /*
@@ -4603,10 +4498,7 @@ PostmasterStateMachine(void)
                        Assert(CheckpointerPID == 0);
                        Assert(WalWriterPID == 0);
                        Assert(AutoVacPID == 0);
-<<<<<<< HEAD
                        Assert(LoginMonitorPID == 0);
-=======
->>>>>>> REL_16_9
                        /* syslogger is not considered here */
                        pmState = PM_NO_CHILDREN;
                }
@@ -4699,15 +4591,13 @@ PostmasterStateMachine(void)
                /* crash recovery started, reset SIGKILL flag */
                AbortStartTime = 0;
 
-<<<<<<< HEAD
                if (start_bgworkers_hook)
                {
                        (*start_bgworkers_hook) (FatalError, pmState, 
do_start_bgworker);
                }
-=======
+
                /* start accepting server socket connection events again */
                ConfigurePostmasterWaitSet(true);
->>>>>>> REL_16_9
        }
 }
 
@@ -4838,13 +4728,8 @@ TerminateChildren(int signal)
                signal_child(AutoVacPID, signal);
        if (PgArchPID != 0)
                signal_child(PgArchPID, signal);
-<<<<<<< HEAD
-       if (PgStatPID != 0)
-               signal_child(PgStatPID, signal);
        if (enable_password_profile && LoginMonitorPID != 0)
                signal_child(LoginMonitorPID, signal);
-=======
->>>>>>> REL_16_9
 }
 
 /*
@@ -4891,13 +4776,8 @@ BackendStartup(Port *port)
 
        /* Pass down canAcceptConnections state */
        port->canAcceptConnections = canAcceptConnections(BACKEND_TYPE_NORMAL);
-<<<<<<< HEAD
        bn->dead_end = (port->canAcceptConnections != CAC_OK &&
-                                       port->canAcceptConnections != 
CAC_SUPERUSER &&
                                        port->canAcceptConnections != 
CAC_MIRROR_READY);
-=======
-       bn->dead_end = (port->canAcceptConnections != CAC_OK);
->>>>>>> REL_16_9
 
        /*
         * Unless it's a dead_end child, assign it a child slot number
@@ -5199,11 +5079,7 @@ BackendInitialize(Port *port)
        }
 
        appendStringInfo(&ps_data, "%s ", port->user_name);
-<<<<<<< HEAD
-       if (!am_walsender && !am_ftshandler && !am_faulthandler)
-=======
        if (port->database_name[0] != '\0')
->>>>>>> REL_16_9
                appendStringInfo(&ps_data, "%s ", port->database_name);
        appendStringInfoString(&ps_data, port->remote_host);
        if (port->remote_port[0] != '\0')
@@ -5640,13 +5516,9 @@ SubPostmasterMain(int argc, char *argv[])
        if (strcmp(argv[1], "--forkbackend") == 0   ||
                strcmp(argv[1], "--forkavlauncher") == 0 ||
                strcmp(argv[1], "--forkavworker") == 0 ||
-<<<<<<< HEAD
                strcmp(argv[1], "--forkautovac") == 0   ||
                strcmp(argv[1], "--forkglobaldeadlockdetector") == 0 ||
-               strcmp(argv[1], "--forkboot") == 0 ||
-=======
                strcmp(argv[1], "--forkaux") == 0 ||
->>>>>>> REL_16_9
                strncmp(argv[1], "--forkbgworker=", 15) == 0)
                PGSharedMemoryReAttach();
        else
@@ -5864,12 +5736,9 @@ process_pm_pmsignal(void)
 {
        pending_pm_pmsignal = false;
 
-<<<<<<< HEAD
-=======
        ereport(DEBUG2,
                        (errmsg_internal("postmaster received pmsignal 
signal")));
 
->>>>>>> REL_16_9
        /*
         * RECOVERY_STARTED and BEGIN_HOT_STANDBY signals are ignored in
         * unexpected states. If the startup process quickly starts up, 
completes
@@ -6074,11 +5943,6 @@ process_pm_pmsignal(void)
                 */
                signal_child(StartupPID, SIGUSR2);
        }
-<<<<<<< HEAD
-
-       errno = save_errno;
-=======
->>>>>>> REL_16_9
 }
 
 /*
diff --git a/src/backend/postmaster/syslogger.c 
b/src/backend/postmaster/syslogger.c
index 6e00c60b673..c6b9aebf680 100644
--- a/src/backend/postmaster/syslogger.c
+++ b/src/backend/postmaster/syslogger.c
@@ -167,19 +167,14 @@ static FILE *logfile_open(const char *filename, const 
char *mode,
 #ifdef WIN32
 static unsigned int __stdcall pipeThread(void *arg);
 #endif
-<<<<<<< HEAD
 static bool logfile_rotate(bool time_based_rotation, bool size_based_rotation, 
const char *suffix,
                                                   const char *log_directory, 
const char *log_filename,
                            FILE **fh, char **last_log_file_name);
 static char *logfile_getname(pg_time_t timestamp, const char *suffix, const 
char *log_directory, const char *log_file_pattern);
-=======
-static void logfile_rotate(bool time_based_rotation, int size_rotation_for);
 static bool logfile_rotate_dest(bool time_based_rotation,
                                                                int 
size_rotation_for, pg_time_t fntime,
                                                                int 
target_dest, char **last_file_name,
                                                                FILE **logFile);
-static char *logfile_getname(pg_time_t timestamp, const char *suffix);
->>>>>>> REL_16_9
 static void set_next_rotation_time(void);
 static void sigUsr1Handler(SIGNAL_ARGS);
 static void update_metainfo_datafile(void);
@@ -250,12 +245,7 @@ SysLoggerMain(int argc, char *argv[])
         * SubPostmasterMain).
         */
 #ifdef WIN32
-<<<<<<< HEAD
        _setmode(_fileno(stderr),_O_TEXT);
-=======
-       else
-               _setmode(STDERR_FILENO, _O_TEXT);
->>>>>>> REL_16_9
 #endif
 
        redirection_done = true;
@@ -315,17 +305,11 @@ SysLoggerMain(int argc, char *argv[])
         * time because passing down just the pg_time_t is a lot cheaper than
         * passing a whole file path in the EXEC_BACKEND case.
         */
-<<<<<<< HEAD
-       last_file_name = logfile_getname(first_syslogger_file_time, NULL, 
Log_directory, Log_filename);
+       last_sys_file_name = logfile_getname(first_syslogger_file_time, NULL, 
Log_directory, Log_filename);
        if (csvlogFile != NULL)
                last_csv_file_name = logfile_getname(first_syslogger_file_time, 
".csv", Log_directory, Log_filename);
-=======
-       last_sys_file_name = logfile_getname(first_syslogger_file_time, NULL);
-       if (csvlogFile != NULL)
-               last_csv_file_name = logfile_getname(first_syslogger_file_time, 
".csv");
        if (jsonlogFile != NULL)
-               last_json_file_name = 
logfile_getname(first_syslogger_file_time, ".json");
->>>>>>> REL_16_9
+               last_json_file_name = 
logfile_getname(first_syslogger_file_time, ".json", Log_directory, 
Log_filename);
 
        /* remember active logfile parameters */
        currentLogDir = pstrdup(Log_directory);
@@ -499,19 +483,23 @@ SysLoggerMain(int argc, char *argv[])
                         * was sent by pg_rotate_logfile() or "pg_ctl 
logrotate".
                         */
                        if (!time_based_rotation && size_rotation_for == 0)
-<<<<<<< HEAD
-                               size_rotation_for = LOG_DESTINATION_STDERR | 
LOG_DESTINATION_CSVLOG;
-
+                               size_rotation_for = LOG_DESTINATION_STDERR |
+                                                                       
LOG_DESTINATION_CSVLOG |
+                                                                       
LOG_DESTINATION_JSONLOG;
                        rotation_requested = false;
 
                        all_rotations_occurred &=
                                logfile_rotate(time_based_rotation, 
(size_rotation_for & LOG_DESTINATION_STDERR) != 0,
                                                           NULL, Log_directory, 
Log_filename,
-                                                          &syslogFile, 
&last_file_name);
+                                                          &syslogFile, 
&last_sys_file_name);
                        all_rotations_occurred &=
                                logfile_rotate(time_based_rotation, 
(size_rotation_for & LOG_DESTINATION_CSVLOG) != 0,
                                                           ".csv", 
Log_directory, Log_filename,
                                                           &csvlogFile, 
&last_csv_file_name);
+                       all_rotations_occurred &=
+                                       logfile_rotate(time_based_rotation, 
(size_rotation_for & LOG_DESTINATION_CSVLOG) != 0,
+                                                                  ".csv", 
Log_directory, Log_filename,
+                                                                  
&jsonlogFile, &last_json_file_name;
                }
 
                /*
@@ -524,12 +512,6 @@ SysLoggerMain(int argc, char *argv[])
                {
                        set_next_rotation_time();
                        update_metainfo_datafile();
-=======
-                               size_rotation_for = LOG_DESTINATION_STDERR |
-                                       LOG_DESTINATION_CSVLOG |
-                                       LOG_DESTINATION_JSONLOG;
-                       logfile_rotate(time_based_rotation, size_rotation_for);
->>>>>>> REL_16_9
                }
 
                /*
@@ -1551,26 +1533,11 @@ process_pipe_input(char *logbuffer, int 
*bytes_in_logbuffer)
        while (count >= sizeof(PipeProtoHeader))
        {
                PipeProtoHeader p;
-<<<<<<< HEAD
                int chunklen;
 
                /* Do we have a valid header? */
                memcpy(&p, cursor, PIPE_HEADER_SIZE);
                if (chunk_is_postgres_chunk(&p))
-=======
-               int                     chunklen;
-               bits8           dest_flags;
-
-               /* Do we have a valid header? */
-               memcpy(&p, cursor, offsetof(PipeProtoHeader, data));
-               dest_flags = p.flags & (PIPE_PROTO_DEST_STDERR |
-                                                               
PIPE_PROTO_DEST_CSVLOG |
-                                                               
PIPE_PROTO_DEST_JSONLOG);
-               if (p.nuls[0] == '\0' && p.nuls[1] == '\0' &&
-                       p.len > 0 && p.len <= PIPE_MAX_PAYLOAD &&
-                       p.pid != 0 &&
-                       pg_popcount((char *) &dest_flags, 1) == 1)
->>>>>>> REL_16_9
                {
                        List       *buffer_list;
                        ListCell   *cell;
@@ -1584,10 +1551,6 @@ process_pipe_input(char *logbuffer, int 
*bytes_in_logbuffer)
                        if (count < chunklen)
                                break;
 
-<<<<<<< HEAD
-                       dest = (p.log_format == 'c' || p.log_format == 'f') ?
-                               LOG_DESTINATION_CSVLOG : LOG_DESTINATION_STDERR;
-=======
                        if ((p.flags & PIPE_PROTO_DEST_STDERR) != 0)
                                dest = LOG_DESTINATION_STDERR;
                        else if ((p.flags & PIPE_PROTO_DEST_CSVLOG) != 0)
@@ -1599,7 +1562,6 @@ process_pipe_input(char *logbuffer, int 
*bytes_in_logbuffer)
                                /* this should never happen as of the header 
validation */
                                Assert(false);
                        }
->>>>>>> REL_16_9
 
                        /* Locate any existing buffer for this source pid */
                        buffer_list = buffer_lists[p.pid % NBUFFER_LISTS];
@@ -2007,7 +1969,6 @@ logfile_open(const char *filename, const char *mode, bool 
allow_errors)
 }
 
 /*
-<<<<<<< HEAD
  * perform logfile rotation.
  *
  * In GPDB, this has been modified significantly from the upstream version:
@@ -2021,7 +1982,6 @@ logfile_open(const char *filename, const char *mode, bool 
allow_errors)
  *   has to do it once all calls to this function return true (i.e. after all
  *   rotations have been successfully completed for the current timestamp), to
  *   avoid having the filename timestamp advance multiple times per rotation.
-=======
  * Do logfile rotation for a single destination, as specified by target_dest.
  * The information stored in *last_file_name and *logFile is updated on a
  * successful file rotation.
@@ -2127,7 +2087,6 @@ logfile_rotate_dest(bool time_based_rotation, int 
size_rotation_for,
 
 /*
  * perform logfile rotation
->>>>>>> REL_16_9
  */
 static bool
 logfile_rotate(bool time_based_rotation, bool size_based_rotation,
@@ -2138,12 +2097,7 @@ logfile_rotate(bool time_based_rotation, bool 
size_based_rotation,
                char **last_log_file_name)
 {
        pg_time_t       fntime;
-<<<<<<< HEAD
        FILE       *fh = *fh_p;
-=======
-
-       rotation_requested = false;
->>>>>>> REL_16_9
 
        /*
         * When doing a time-based rotation, invent the new logfile name based 
on
@@ -2154,35 +2108,12 @@ logfile_rotate(bool time_based_rotation, bool 
size_based_rotation,
                fntime = next_rotation_time;
        else
                fntime = time(NULL);
-<<<<<<< HEAD
-       filename = logfile_getname(fntime, suffix, log_directory, log_filename);
-       if (Log_destination & LOG_DESTINATION_CSVLOG)
-               csvfilename = logfile_getname(fntime, ".csv", log_directory, 
log_filename);
-
-       /*
-        * Decide whether to overwrite or append.  We can overwrite if (a)
-        * Log_truncate_on_rotation is set, (b) the rotation was triggered by
-        * elapsed time and not something else, and (c) the computed file name 
is
-        * different from what we were previously logging into.
-        *
-        * Note: last_file_name should never be NULL here, but if it is, append.
-        */
-       if (time_based_rotation || size_based_rotation)
-       {
-               if (Log_truncate_on_rotation && time_based_rotation &&
-                       *last_log_file_name != NULL &&
-                       strcmp(filename, *last_log_file_name) != 0)
-                       fh = logfile_open(filename, "w", true);
-               else
-                       fh = logfile_open(filename, "a", true);
-=======
 
        /* file rotation for stderr */
        if (!logfile_rotate_dest(time_based_rotation, size_rotation_for, fntime,
                                                         
LOG_DESTINATION_STDERR, &last_sys_file_name,
                                                         &syslogFile))
                return;
->>>>>>> REL_16_9
 
        /* file rotation for csvlog */
        if (!logfile_rotate_dest(time_based_rotation, size_rotation_for, fntime,
@@ -2190,103 +2121,12 @@ logfile_rotate(bool time_based_rotation, bool 
size_based_rotation,
                                                         &csvlogFile))
                return;
 
-<<<<<<< HEAD
-                       if (filename)
-                               pfree(filename);
-                       return false;
-               }
-
-               if (*fh_p)
-                       fclose(*fh_p);
-               *fh_p = fh;
-
-               /* instead of pfree'ing filename, remember it for next time */
-               if ((*last_log_file_name) != NULL)
-                       pfree(*last_log_file_name);
-               *last_log_file_name = filename;
-               filename = NULL;
-       }
 
-/* 
- * In gpdb, `logfile_rotate` will be called separately for both csv and std 
log destination.
- * We keep the code below in order to make code merging easier.
- * Note the API for this function is different. PG upstream has 
size_rotation_for however gpdb
- * does not have. That's becasue we deal with size_rotation_for before calling 
this function.
- * We'll call this function separately for both cases and only pass the 
size_based_rotation
- * as arguments.
- */
-#if 0
-       /*
-        * Same as above, but for csv file.  Note that if LOG_DESTINATION_CSVLOG
-        * was just turned on, we might have to open csvlogFile here though it 
was
-        * not open before.  In such a case we'll append not overwrite (since
-        * last_csv_file_name will be NULL); that is consistent with the normal
-        * rules since it's not a time-based rotation.
-        */
-       if ((Log_destination & LOG_DESTINATION_CSVLOG) &&
-               (csvlogFile == NULL ||
-                time_based_rotation || (size_rotation_for & 
LOG_DESTINATION_CSVLOG)))
-       {
-               if (Log_truncate_on_rotation && time_based_rotation &&
-                       last_csv_file_name != NULL &&
-                       strcmp(csvfilename, last_csv_file_name) != 0)
-                       fh = logfile_open(csvfilename, "w", true);
-               else
-                       fh = logfile_open(csvfilename, "a", true);
-
-               if (!fh)
-               {
-                       /*
-                        * ENFILE/EMFILE are not too surprising on a busy 
system; just
-                        * keep using the old file till we manage to get a new 
one.
-                        * Otherwise, assume something's wrong with 
Log_directory and stop
-                        * trying to create files.
-                        */
-                       if (errno != ENFILE && errno != EMFILE)
-                       {
-                               ereport(LOG,
-                                               (errmsg("disabling automatic 
rotation (use SIGHUP to re-enable)")));
-                               rotation_disabled = true;
-                       }
-
-                       if (filename)
-                               pfree(filename);
-                       if (csvfilename)
-                               pfree(csvfilename);
-                       return;
-               }
-
-               if (csvlogFile != NULL)
-                       fclose(csvlogFile);
-               csvlogFile = fh;
-
-               /* instead of pfree'ing filename, remember it for next time */
-               if (last_csv_file_name != NULL)
-                       pfree(last_csv_file_name);
-               last_csv_file_name = csvfilename;
-               csvfilename = NULL;
-       }
-       else if (!(Log_destination & LOG_DESTINATION_CSVLOG) &&
-                        csvlogFile != NULL)
-       {
-               /* CSVLOG was just turned off, so close the old file */
-               fclose(csvlogFile);
-               csvlogFile = NULL;
-               if (last_csv_file_name != NULL)
-                       pfree(last_csv_file_name);
-               last_csv_file_name = NULL;
-       }
-#endif
-
-       if (filename)
-               pfree(filename);
-=======
        /* file rotation for jsonlog */
        if (!logfile_rotate_dest(time_based_rotation, size_rotation_for, fntime,
                                                         
LOG_DESTINATION_JSONLOG, &last_json_file_name,
                                                         &jsonlogFile))
                return;
->>>>>>> REL_16_9
 
        return true;
 }
diff --git a/src/common/percentrepl.c b/src/common/percentrepl.c
index c8a93b6300a..5c5a4fa0aa2 100644
--- a/src/common/percentrepl.c
+++ b/src/common/percentrepl.c
@@ -90,10 +90,14 @@ replace_percent_placeholders(const char *instr, const char 
*param_name, const ch
                        }
                        else if (sp[1] == 'c')
                        {
+                               char            contentid[12];
+
                                /* GPDB: %c: contentId of segment */
                                Assert(GpIdentity.segindex != 
UNINITIALIZED_GP_IDENTITY_VALUE);
                                sp++;
                                pg_ltoa(GpIdentity.segindex, contentid);
+                               appendStringInfoString(&result, contentid);
+                               break;
                        }
                        else if (sp[1] == 'R')
                        {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cloudberry.apache.org
For additional commands, e-mail: commits-h...@cloudberry.apache.org


Reply via email to