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 01c48eded54 Enable pg_ctl
01c48eded54 is described below

commit 01c48eded547380c079a69ae8a9d6d94b3593a6e
Author: Jinbao Chen <[email protected]>
AuthorDate: Wed Oct 15 23:01:57 2025 +0800

    Enable pg_ctl
---
 src/bin/Makefile                   |  3 +-
 src/bin/pg_ctl/nls.mk              |  5 ---
 src/bin/pg_ctl/pg_ctl.c            | 66 --------------------------------------
 src/bin/pg_ctl/t/001_start_stop.pl | 22 ++-----------
 src/bin/pg_ctl/t/004_logrotate.pl  | 24 ++++----------
 5 files changed, 10 insertions(+), 110 deletions(-)

diff --git a/src/bin/Makefile b/src/bin/Makefile
index 898afc20e93..d5480add39f 100644
--- a/src/bin/Makefile
+++ b/src/bin/Makefile
@@ -40,7 +40,8 @@ unittest-check:
 #      scripts
 
 SUBDIRS = \
-       initdb
+       initdb \
+       pg_ctl
 
 ifeq ($(PORTNAME), win32)
 SUBDIRS += pgevent
diff --git a/src/bin/pg_ctl/nls.mk b/src/bin/pg_ctl/nls.mk
index 1ebb85036d9..fd6355483c4 100644
--- a/src/bin/pg_ctl/nls.mk
+++ b/src/bin/pg_ctl/nls.mk
@@ -1,12 +1,7 @@
 # src/bin/pg_ctl/nls.mk
 CATALOG_NAME     = pg_ctl
-<<<<<<< HEAD
-AVAIL_LANGUAGES  = cs de el es fr it ja ko ru sv tr uk zh_CN
-GETTEXT_FILES    = pg_ctl.c ../../common/exec.c ../../common/fe_memutils.c 
../../common/wait_error.c ../../port/path.c
-=======
 GETTEXT_FILES    = pg_ctl.c \
                    ../../common/exec.c \
                    ../../common/fe_memutils.c \
                    ../../common/wait_error.c \
                    ../../port/path.c
->>>>>>> REL_16_9
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
index 8ca22c4ac13..cda7145dca8 100644
--- a/src/bin/pg_ctl/pg_ctl.c
+++ b/src/bin/pg_ctl/pg_ctl.c
@@ -161,12 +161,8 @@ static void free_readfile(char **optlines);
 static pid_t start_postmaster(void);
 static void read_post_opts(void);
 
-<<<<<<< HEAD
 static bool is_secondary_instance(const char *pg_data);
-static WaitPMResult wait_for_postmaster_start(pgpid_t pm_pid, bool 
do_checkpoint);
-=======
 static WaitPMResult wait_for_postmaster_start(pid_t pm_pid, bool 
do_checkpoint);
->>>>>>> REL_16_9
 static bool wait_for_postmaster_stop(void);
 static bool wait_for_postmaster_promote(void);
 static bool postmaster_is_alive(pid_t pid);
@@ -455,12 +451,8 @@ free_readfile(char **optlines)
 static pid_t
 start_postmaster(void)
 {
-<<<<<<< HEAD
        char            launcher[MAXPGPATH] = "";
        char       *cmd, *term_fd_opt = NULL;
-=======
-       char       *cmd;
->>>>>>> REL_16_9
 
 #ifndef WIN32
        pid_t           pm_pid;
@@ -529,7 +521,6 @@ start_postmaster(void)
         * has the same PID as the current child process.
         */
        if (log_file != NULL)
-<<<<<<< HEAD
                cmd = psprintf("exec %s \"%s\" %s%s%s < \"%s\" >> \"%s\" 2>&1",
                                           launcher, exec_path, pgdata_opt, 
post_opts,
                                           term_fd_opt ? term_fd_opt : "",
@@ -538,14 +529,6 @@ start_postmaster(void)
                cmd = psprintf("exec %s \"%s\" %s%s%s < \"%s\" 2>&1",
                                           launcher, exec_path, pgdata_opt, 
post_opts, 
                                           term_fd_opt ? term_fd_opt : "", 
DEVNULL);
-=======
-               cmd = psprintf("exec \"%s\" %s%s < \"%s\" >> \"%s\" 2>&1",
-                                          exec_path, pgdata_opt, post_opts,
-                                          DEVNULL, log_file);
-       else
-               cmd = psprintf("exec \"%s\" %s%s < \"%s\" 2>&1",
-                                          exec_path, pgdata_opt, post_opts, 
DEVNULL);
->>>>>>> REL_16_9
 
        (void) execl("/bin/sh", "/bin/sh", "-c", cmd, (char *) NULL);
 
@@ -621,7 +604,6 @@ start_postmaster(void)
                else
                        close(fd);
 
-<<<<<<< HEAD
                cmd = psprintf("\"%s\" /C \"\"%s\" %s%s%s < \"%s\" >> \"%s\" 
2>&1\"",
                                           comspec, exec_path, pgdata_opt, 
post_opts,
                                           term_fd_opt ? term_fd_opt : "", 
DEVNULL, log_file);
@@ -630,14 +612,6 @@ start_postmaster(void)
                cmd = psprintf("\"%s\" /C \"\"%s\" %s%s%s < \"%s\" 2>&1\"",
                                           comspec, exec_path, pgdata_opt, 
post_opts,
                                           term_fd_opt ? term_fd_opt : "", 
DEVNULL);
-=======
-               cmd = psprintf("\"%s\" /D /C \"\"%s\" %s%s < \"%s\" >> \"%s\" 
2>&1\"",
-                                          comspec, exec_path, pgdata_opt, 
post_opts, DEVNULL, log_file);
-       }
-       else
-               cmd = psprintf("\"%s\" /D /C \"\"%s\" %s%s < \"%s\" 2>&1\"",
-                                          comspec, exec_path, pgdata_opt, 
post_opts, DEVNULL);
->>>>>>> REL_16_9
 
        if (!CreateRestrictedProcess(cmd, &pi, false))
        {
@@ -683,11 +657,7 @@ is_secondary_instance(const char *pg_data)
  * manager checkpoint, it's got nothing to do with database checkpoints!!
  */
 static WaitPMResult
-<<<<<<< HEAD
-wait_for_postmaster_start(pgpid_t pm_pid, bool do_checkpoint)
-=======
 wait_for_postmaster_start(pid_t pm_pid, bool do_checkpoint)
->>>>>>> REL_16_9
 {
        int                     i;
        bool            is_coordinator;
@@ -820,20 +790,12 @@ wait_for_postmaster_stop(void)
 
        for (cnt = 0; cnt < wait_seconds * WAITS_PER_SEC; cnt++)
        {
-<<<<<<< HEAD
-               pgpid_t         pid;
-=======
                pid_t           pid;
->>>>>>> REL_16_9
 
                if ((pid = get_pgpid(false)) == 0)
                        return true;            /* pid file is gone */
 
-<<<<<<< HEAD
-               if (kill((pid_t) pid, 0) != 0)
-=======
                if (kill(pid, 0) != 0)
->>>>>>> REL_16_9
                {
                        /*
                         * Postmaster seems to have died.  Check the pid file 
once more to
@@ -865,20 +827,12 @@ wait_for_postmaster_promote(void)
 
        for (cnt = 0; cnt < wait_seconds * WAITS_PER_SEC; cnt++)
        {
-<<<<<<< HEAD
-               pgpid_t         pid;
-=======
                pid_t           pid;
->>>>>>> REL_16_9
                DBState         state;
 
                if ((pid = get_pgpid(false)) == 0)
                        return false;           /* pid file is gone */
-<<<<<<< HEAD
-               if (kill((pid_t) pid, 0) != 0)
-=======
                if (kill(pid, 0) != 0)
->>>>>>> REL_16_9
                        return false;           /* postmaster died */
 
                state = get_control_dbstate();
@@ -893,11 +847,7 @@ wait_for_postmaster_promote(void)
 }
 
 
-<<<<<<< HEAD
-#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_CORE)
-=======
 #if defined(HAVE_GETRLIMIT)
->>>>>>> REL_16_9
 static void
 unlimit_core_size(void)
 {
@@ -1142,12 +1092,7 @@ do_start(void)
 static void
 do_stop(void)
 {
-<<<<<<< HEAD
-       pgpid_t         pid;
-       struct stat statbuf;
-=======
        pid_t           pid;
->>>>>>> REL_16_9
 
        pid = get_pgpid(false);
 
@@ -1206,12 +1151,7 @@ do_stop(void)
 static void
 do_restart(void)
 {
-<<<<<<< HEAD
-       pgpid_t         pid;
-       struct stat statbuf;
-=======
        pid_t           pid;
->>>>>>> REL_16_9
 
        pid = get_pgpid(false);
 
@@ -2170,11 +2110,8 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION 
*processInfo, bool as_ser
                }
        }
 
-<<<<<<< HEAD
     AddUserToTokenDacl(processInfo->hProcess);
 
-=======
->>>>>>> REL_16_9
        CloseHandle(restrictedToken);
 
        ResumeThread(processInfo->hThread);
@@ -2450,10 +2387,7 @@ adjust_data_dir(void)
                                   my_exec_path,
                                   pgdata_opt ? pgdata_opt : "",
                                   post_opts ? post_opts : "");
-<<<<<<< HEAD
-=======
        fflush(NULL);
->>>>>>> REL_16_9
 
        fd = popen(cmd, "r");
        if (fd == NULL || fgets(filename, sizeof(filename), fd) == NULL || 
pclose(fd) != 0)
diff --git a/src/bin/pg_ctl/t/001_start_stop.pl 
b/src/bin/pg_ctl/t/001_start_stop.pl
index 6a410e83c61..e89d93cb0ab 100644
--- a/src/bin/pg_ctl/t/001_start_stop.pl
+++ b/src/bin/pg_ctl/t/001_start_stop.pl
@@ -4,24 +4,12 @@
 use strict;
 use warnings;
 
-<<<<<<< HEAD
-use Config;
-use Fcntl ':mode';
-use File::stat qw{lstat};
-use PostgresNode;
-use TestLib;
-use Test::More tests => 26;
-
-my $tempdir = TestLib::tempdir;
-my $tempdir_short = TestLib::tempdir_short;
-=======
 use PostgreSQL::Test::Cluster;
 use PostgreSQL::Test::Utils;
 use Test::More;
 
 my $tempdir = PostgreSQL::Test::Utils::tempdir;
 my $tempdir_short = PostgreSQL::Test::Utils::tempdir_short;
->>>>>>> REL_16_9
 
 program_help_ok('pg_ctl');
 program_version_ok('pg_ctl');
@@ -54,12 +42,8 @@ else
 close $conf;
 my $ctlcmd = [
        'pg_ctl', 'start', '-D', "$tempdir/data", '-l',
-<<<<<<< HEAD
-       "$TestLib::log_path/001_start_stop_server.log"
-       ,'-o', '-c gp_role=utility --gp_dbid=-1 --gp_contentid=-1',
-=======
        "$PostgreSQL::Test::Utils::log_path/001_start_stop_server.log"
->>>>>>> REL_16_9
+       ,'-o', '-c gp_role=utility --gp_dbid=-1 --gp_contentid=-1',
 ];
 command_like($ctlcmd, qr/done.*server started/s, 'pg_ctl start');
 
@@ -120,7 +104,6 @@ command_ok([ 'pg_ctl', 'restart', '-D', "$tempdir/data" ],
 
 system_or_bail 'pg_ctl', 'stop', '-D', "$tempdir/data";
 
-<<<<<<< HEAD
 # gpdb specific: verify that --wrapper and --wrapper-args work as expected
 if (not $windows_os)
 {
@@ -144,6 +127,5 @@ if (not $windows_os)
 
        system_or_bail 'pg_ctl', 'stop', '-D', "$tempdir/data", '-m', 'fast';
 }
-=======
+
 done_testing();
->>>>>>> REL_16_9
diff --git a/src/bin/pg_ctl/t/004_logrotate.pl 
b/src/bin/pg_ctl/t/004_logrotate.pl
index 88d7250cd2f..0345f819c56 100644
--- a/src/bin/pg_ctl/t/004_logrotate.pl
+++ b/src/bin/pg_ctl/t/004_logrotate.pl
@@ -78,11 +78,7 @@ $node->start();
 $node->psql('postgres', 'SELECT 1/0');
 
 # might need to retry if logging collector process is slow...
-<<<<<<< HEAD
-my $max_attempts = 10 * $TestLib::timeout_default;
-=======
 my $max_attempts = 10 * $PostgreSQL::Test::Utils::timeout_default;
->>>>>>> REL_16_9
 
 my $current_logfiles;
 for (my $attempts = 0; $attempts < $max_attempts; $attempts++)
@@ -99,13 +95,9 @@ note "current_logfiles = $current_logfiles";
 
 like(
        $current_logfiles,
-<<<<<<< HEAD
-       qr|^stderr log/gpdb-.*csv$|,
-=======
-       qr|^stderr log/postgresql-.*log
-csvlog log/postgresql-.*csv
-jsonlog log/postgresql-.*json$|,
->>>>>>> REL_16_9
+       qr|^stderr log/gpdb-.*log
+csvlog log/gpdb-.*csv
+jsonlog log/gpdb-.*json$|,
        'current_logfiles is sane');
 
 check_log_pattern('stderr', $current_logfiles, 'division by zero', $node);
@@ -131,13 +123,9 @@ note "now current_logfiles = $new_current_logfiles";
 
 like(
        $new_current_logfiles,
-<<<<<<< HEAD
-       qr|^stderr log/gpdb-.*csv$|,
-=======
-       qr|^stderr log/postgresql-.*log
-csvlog log/postgresql-.*csv
-jsonlog log/postgresql-.*json$|,
->>>>>>> REL_16_9
+       qr|^stderr log/gpdb-.*log
+csvlog log/gpdb-.*csv
+jsonlog log/gpdb-.*json$|,
        'new current_logfiles is sane');
 
 # Verify that log output gets to this file, too


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

Reply via email to