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 90bbbd0690c Fix compile errors for postmaster
90bbbd0690c is described below
commit 90bbbd0690c9768f8365552795fcbe73e95e8bc2
Author: Jinbao Chen <[email protected]>
AuthorDate: Sat Oct 4 20:35:15 2025 +0800
Fix compile errors for postmaster
---
src/backend/postmaster/backoff.c | 7 +-----
src/backend/postmaster/loginmonitor.c | 5 ++--
src/backend/postmaster/pgarch.c | 26 --------------------
src/backend/postmaster/postmaster.c | 46 +++--------------------------------
src/backend/postmaster/syslogger.c | 34 ++++++++------------------
5 files changed, 16 insertions(+), 102 deletions(-)
diff --git a/src/backend/postmaster/backoff.c b/src/backend/postmaster/backoff.c
index e11384b3d5c..e3c58b5716a 100644
--- a/src/backend/postmaster/backoff.c
+++ b/src/backend/postmaster/backoff.c
@@ -27,12 +27,6 @@
*/
#include "postgres.h"
-#ifndef HAVE_GETRUSAGE
-#include "rusagestub.h"
-#else
-#include <sys/time.h>
-#include <sys/resource.h>
-#endif
#include <sys/time.h>
#include <signal.h>
#include <math.h>
@@ -57,6 +51,7 @@
#include "postmaster/backoff.h"
#include "pg_trace.h"
#include "pgstat.h"
+#include "sys/resource.h"
extern bool gp_debug_resqueue_priority;
diff --git a/src/backend/postmaster/loginmonitor.c
b/src/backend/postmaster/loginmonitor.c
index aeb69cad803..1f1a6941474 100644
--- a/src/backend/postmaster/loginmonitor.c
+++ b/src/backend/postmaster/loginmonitor.c
@@ -255,7 +255,7 @@ LoginMonitorLauncherMain(int argc, char *argv[]) {
InitProcess();
#endif
- InitPostgres(NULL, InvalidOid, NULL, InvalidOid, NULL, false);
+ InitPostgres(NULL, InvalidOid, NULL, InvalidOid, false, false, NULL);
SetProcessingMode(NormalProcessing);
@@ -303,7 +303,6 @@ LoginMonitorLauncherMain(int argc, char *argv[]) {
* transaction.
*/
LWLockReleaseAll();
- AbortBufferIO();
UnlockBuffers();
/* this is probably dead code, but let's be safe: */
if (AuxProcessResourceOwner)
@@ -588,7 +587,7 @@ LoginMonitorWorkerMain(int argc, char *argv[]) {
if (LoginMonitorShmem->curr_user_name[0] != '\0')
{
- InitPostgres(DB_FOR_COMMON_ACCESS, InvalidOid, NULL,
InvalidOid, NULL, false);
+ InitPostgres(DB_FOR_COMMON_ACCESS, InvalidOid, NULL,
InvalidOid, false, false, NULL);
SetProcessingMode(NormalProcessing);
set_ps_display(LoginMonitorShmem->curr_user_name);
ereport(DEBUG1,
diff --git a/src/backend/postmaster/pgarch.c b/src/backend/postmaster/pgarch.c
index 5f3f50b4df2..942304928bc 100644
--- a/src/backend/postmaster/pgarch.c
+++ b/src/backend/postmaster/pgarch.c
@@ -107,32 +107,6 @@ static PgArchData *PgArch = NULL;
static const ArchiveModuleCallbacks *ArchiveCallbacks;
static ArchiveModuleState *archive_module_state;
-
-/*
- * Stuff for tracking multiple files to archive from each scan of
- * archive_status. Minimizing the number of directory scans when there are
- * many files to archive can significantly improve archival rate.
- *
- * arch_heap is a max-heap that is used during the directory scan to track
- * the highest-priority files to archive. After the directory scan
- * completes, the file names are stored in ascending order of priority in
- * arch_files. pgarch_readyXlog() returns files from arch_files until it
- * is empty, at which point another directory scan must be performed.
- *
- * We only need this data in the archiver process, so make it a palloc'd
- * struct rather than a bunch of static arrays.
- */
-struct arch_files_state
-{
- binaryheap *arch_heap;
- int arch_files_size; /* number of live
entries in arch_files[] */
- char *arch_files[NUM_FILES_PER_DIRECTORY_SCAN];
- /* buffers underlying heap, and later arch_files[], entries: */
- char
arch_filenames[NUM_FILES_PER_DIRECTORY_SCAN][MAX_XFN_CHARS + 1];
-};
-
-static struct arch_files_state *arch_files = NULL;
-
/*
* Stuff for tracking multiple files to archive from each scan of
* archive_status. Minimizing the number of directory scans when there are
diff --git a/src/backend/postmaster/postmaster.c
b/src/backend/postmaster/postmaster.c
index 245e7c75866..b30bcbf3952 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -542,7 +542,6 @@ static int BackendStartup(Port *port);
static int ProcessStartupPacket(Port *port, bool ssl_done, bool gss_done);
static void SendNegotiateProtocolVersion(List *unrecognized_protocol_options);
static void processCancelRequest(Port *port, void *pkt, MsgType code);
-static int initMasks(fd_set *rmask);
static void report_fork_failure_to_client(Port *port, int errnum);
static CAC_state canAcceptConnections(int backend_type);
static bool RandomCancelKey(int32 *cancel_key);
@@ -1908,7 +1907,7 @@ checkPgDir(const char *dir)
elog(LOG, "System file or directory missing (%s),
shutting down segment", dir);
/* quit all processes and exit */
- pmdie(SIGQUIT);
+ handle_pm_shutdown_request_signal(SIGQUIT);
}
}
@@ -2277,33 +2276,6 @@ ServerLoop(void)
}
}
-/*
- * Initialise the masks for select() for the ports we are listening on.
- * Return the number of sockets to listen on.
- */
-static int
-initMasks(fd_set *rmask)
-{
- int maxsock = -1;
- int i;
-
- FD_ZERO(rmask);
-
- for (i = 0; i < MAXLISTEN; i++)
- {
- int fd = ListenSocket[i];
-
- if (fd == PGINVALID_SOCKET)
- break;
- FD_SET(fd, rmask);
-
- if (fd > maxsock)
- maxsock = fd;
- }
-
- return maxsock + 1;
-}
-
/*
* Once the flag is reset, libpq connections (e.g. FTS probe requests) should
* not get CAC_MIRROR_READY response. This flag is needed during GPDB startup
@@ -4217,9 +4189,9 @@ HandleChildCrash(int pid, int exitstatus, const char
*procname)
{
ereport(DEBUG2,
(errmsg_internal("sending %s to process %d",
- (SendStop ? "SIGSTOP" :
"SIGQUIT"),
+ ("SIGSTOP/SIGQUIT"),
(int) LoginMonitorPID)));
- signal_child(LoginMonitorPID, (SendStop ? SIGSTOP :
SIGQUIT));
+ sigquit_child(LoginMonitorPID);
}
}
@@ -5762,18 +5734,6 @@ process_pm_pmsignal(void)
if (XLogArchivingAlways())
PgArchPID = StartArchiver();
- /*
- * GPDB: if promote trigger file exist we don't wish to convey
- * PM_STATUS_STANDBY, instead wish pg_ctl -w to wait till
- * connections can be actually accepted by the database.
- */
- if (PromoteTriggerFile != NULL && strcmp(PromoteTriggerFile,
"") != 0)
- {
- struct stat stat_buf;
-
- if (stat(PromoteTriggerFile, &stat_buf) == 0)
- promotion_requested = true;
- }
/*
* GPDB: Setting recovery_target_action
* configuration parameter to 'promote' will also result
diff --git a/src/backend/postmaster/syslogger.c
b/src/backend/postmaster/syslogger.c
index c6b9aebf680..4d2fe6800b0 100644
--- a/src/backend/postmaster/syslogger.c
+++ b/src/backend/postmaster/syslogger.c
@@ -167,9 +167,7 @@ static FILE *logfile_open(const char *filename, const char
*mode,
#ifdef WIN32
static unsigned int __stdcall pipeThread(void *arg);
#endif
-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 bool logfile_rotate(bool time_based_rotation, int size_rotation_for);
static char *logfile_getname(pg_time_t timestamp, const char *suffix, const
char *log_directory, const char *log_file_pattern);
static bool logfile_rotate_dest(bool time_based_rotation,
int
size_rotation_for, pg_time_t fntime,
@@ -489,17 +487,11 @@ SysLoggerMain(int argc, char *argv[])
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_sys_file_name);
+ logfile_rotate(time_based_rotation,
size_rotation_for);
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);
+ logfile_rotate(time_based_rotation,
size_rotation_for);
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;
+ logfile_rotate(time_based_rotation,
size_rotation_for);
}
/*
@@ -726,7 +718,7 @@ SysLogger_Start(void)
*/
if (Log_destination & LOG_DESTINATION_JSONLOG)
{
- filename = logfile_getname(first_syslogger_file_time, ".json");
+ filename = logfile_getname(first_syslogger_file_time, ".json",
Log_directory, Log_filename);
jsonlogFile = logfile_open(filename, "a", false);
@@ -2037,7 +2029,7 @@ logfile_rotate_dest(bool time_based_rotation, int
size_rotation_for,
}
/* build the new file name */
- filename = logfile_getname(fntime, logFileExt);
+ filename = logfile_getname(fntime, logFileExt, Log_directory,
Log_filename);
/*
* Decide whether to overwrite or append. We can overwrite if (a)
@@ -2089,15 +2081,9 @@ logfile_rotate_dest(bool time_based_rotation, int
size_rotation_for,
* perform logfile rotation
*/
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_p,
- char **last_log_file_name)
+logfile_rotate(bool time_based_rotation, int size_rotation_for)
{
pg_time_t fntime;
- FILE *fh = *fh_p;
/*
* When doing a time-based rotation, invent the new logfile name based
on
@@ -2113,20 +2099,20 @@ logfile_rotate(bool time_based_rotation, bool
size_based_rotation,
if (!logfile_rotate_dest(time_based_rotation, size_rotation_for, fntime,
LOG_DESTINATION_STDERR, &last_sys_file_name,
&syslogFile))
- return;
+ return false;
/* file rotation for csvlog */
if (!logfile_rotate_dest(time_based_rotation, size_rotation_for, fntime,
LOG_DESTINATION_CSVLOG, &last_csv_file_name,
&csvlogFile))
- return;
+ return false;
/* file rotation for jsonlog */
if (!logfile_rotate_dest(time_based_rotation, size_rotation_for, fntime,
LOG_DESTINATION_JSONLOG, &last_json_file_name,
&jsonlogFile))
- return;
+ return false;
return true;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]