0004-Adjust-process-type.patch.nocfbot
application/octet-stream
Filename: 0004-Adjust-process-type.patch.nocfbot
Type: application/octet-stream
Part: 1
Message:
Re: refactor backend type lists
From 86327c057965ef0d7dd5818c8ae6be901b7220b0 Mon Sep 17 00:00:00 2001
From: Euler Taveira <euler@eulerto.com>
Date: Thu, 17 Jul 2025 15:43:30 -0300
Subject: [PATCH 4/4] Adjust process type
Let's use an uniform backend type.
Although some of the string are translated, we decided to use the
backend type without translation.
---
src/backend/postmaster/postmaster.c | 40 ++++++++++++++---------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index e01d9f0cfe8..98ba983f18f 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -2285,7 +2285,7 @@ process_pm_child_exit(void)
StartupStatus != STARTUP_SIGNALED &&
!EXIT_STATUS_0(exitstatus))
{
- LogChildExit(LOG, _("startup process"),
+ LogChildExit(LOG, GetBackendTypeDesc(B_STARTUP),
pid, exitstatus);
ereport(LOG,
(errmsg("aborting startup due to startup process failure")));
@@ -2321,7 +2321,7 @@ process_pm_child_exit(void)
else
StartupStatus = STARTUP_CRASHED;
HandleChildCrash(pid, exitstatus,
- _("startup process"));
+ GetBackendTypeDesc(B_STARTUP));
continue;
}
@@ -2366,7 +2366,7 @@ process_pm_child_exit(void)
BgWriterPMChild = NULL;
if (!EXIT_STATUS_0(exitstatus))
HandleChildCrash(pid, exitstatus,
- _("background writer process"));
+ GetBackendTypeDesc(B_BG_WRITER));
continue;
}
@@ -2399,7 +2399,7 @@ process_pm_child_exit(void)
* exit) is treated as a crash.
*/
HandleChildCrash(pid, exitstatus,
- _("checkpointer process"));
+ GetBackendTypeDesc(B_CHECKPOINTER));
}
continue;
@@ -2416,7 +2416,7 @@ process_pm_child_exit(void)
WalWriterPMChild = NULL;
if (!EXIT_STATUS_0(exitstatus))
HandleChildCrash(pid, exitstatus,
- _("WAL writer process"));
+ GetBackendTypeDesc(B_WAL_WRITER));
continue;
}
@@ -2432,7 +2432,7 @@ process_pm_child_exit(void)
WalReceiverPMChild = NULL;
if (!EXIT_STATUS_0(exitstatus) && !EXIT_STATUS_1(exitstatus))
HandleChildCrash(pid, exitstatus,
- _("WAL receiver process"));
+ GetBackendTypeDesc(B_WAL_RECEIVER));
continue;
}
@@ -2447,7 +2447,7 @@ process_pm_child_exit(void)
WalSummarizerPMChild = NULL;
if (!EXIT_STATUS_0(exitstatus))
HandleChildCrash(pid, exitstatus,
- _("WAL summarizer process"));
+ GetBackendTypeDesc(B_WAL_SUMMARIZER));
continue;
}
@@ -2463,7 +2463,7 @@ process_pm_child_exit(void)
AutoVacLauncherPMChild = NULL;
if (!EXIT_STATUS_0(exitstatus))
HandleChildCrash(pid, exitstatus,
- _("autovacuum launcher process"));
+ GetBackendTypeDesc(B_AUTOVAC_LAUNCHER));
continue;
}
@@ -2479,7 +2479,7 @@ process_pm_child_exit(void)
PgArchPMChild = NULL;
if (!EXIT_STATUS_0(exitstatus) && !EXIT_STATUS_1(exitstatus))
HandleChildCrash(pid, exitstatus,
- _("archiver process"));
+ GetBackendTypeDesc(B_ARCHIVER));
continue;
}
@@ -2494,7 +2494,7 @@ process_pm_child_exit(void)
StartSysLogger();
if (!EXIT_STATUS_0(exitstatus))
- LogChildExit(LOG, _("system logger process"),
+ LogChildExit(LOG, GetBackendTypeDesc(B_LOGGER),
pid, exitstatus);
continue;
}
@@ -2512,7 +2512,7 @@ process_pm_child_exit(void)
SlotSyncWorkerPMChild = NULL;
if (!EXIT_STATUS_0(exitstatus) && !EXIT_STATUS_1(exitstatus))
HandleChildCrash(pid, exitstatus,
- _("slot sync worker process"));
+ GetBackendTypeDesc(B_SLOTSYNC_WORKER));
continue;
}
@@ -2520,7 +2520,7 @@ process_pm_child_exit(void)
if (maybe_reap_io_worker(pid))
{
if (!EXIT_STATUS_0(exitstatus) && !EXIT_STATUS_1(exitstatus))
- HandleChildCrash(pid, exitstatus, _("io worker"));
+ HandleChildCrash(pid, exitstatus, GetBackendTypeDesc(B_IO_WORKER));
maybe_adjust_io_workers();
continue;
@@ -2542,9 +2542,9 @@ process_pm_child_exit(void)
else
{
if (!EXIT_STATUS_0(exitstatus) && !EXIT_STATUS_1(exitstatus))
- HandleChildCrash(pid, exitstatus, _("untracked child process"));
+ HandleChildCrash(pid, exitstatus, GetBackendTypeDesc(B_INVALID));
else
- LogChildExit(LOG, _("untracked child process"), pid, exitstatus);
+ LogChildExit(LOG, GetBackendTypeDesc(B_INVALID), pid, exitstatus);
}
} /* loop over pending child-death reports */
@@ -2577,12 +2577,12 @@ CleanupBackend(PMChild *bp,
/* Construct a process name for the log message */
if (bp->bkend_type == B_BG_WORKER)
{
- snprintf(namebuf, MAXPGPATH, _("background worker \"%s\""),
+ snprintf(namebuf, MAXPGPATH, "background worker \"%s\"",
bp->rw->rw_worker.bgw_type);
procname = namebuf;
}
else
- procname = _(GetBackendTypeDesc(bp->bkend_type));
+ procname = GetBackendTypeDesc(bp->bkend_type);
/*
* If a backend dies in an ugly way then we must signal all other backends
@@ -2834,7 +2834,7 @@ LogChildExit(int lev, const char *procname, int pid, int exitstatus)
/*------
translator: %s is a noun phrase describing a child process, such as
"server process" */
- (errmsg("%s (PID %d) exited with exit code %d",
+ (errmsg("process %s (PID %d) exited with exit code %d",
procname, pid, WEXITSTATUS(exitstatus)),
activity ? errdetail("Failed process was running: %s", activity) : 0));
else if (WIFSIGNALED(exitstatus))
@@ -2845,7 +2845,7 @@ LogChildExit(int lev, const char *procname, int pid, int exitstatus)
/*------
translator: %s is a noun phrase describing a child process, such as
"server process" */
- (errmsg("%s (PID %d) was terminated by exception 0x%X",
+ (errmsg("process %s (PID %d) was terminated by exception 0x%X",
procname, pid, WTERMSIG(exitstatus)),
errhint("See C include file \"ntstatus.h\" for a description of the hexadecimal value."),
activity ? errdetail("Failed process was running: %s", activity) : 0));
@@ -2855,7 +2855,7 @@ LogChildExit(int lev, const char *procname, int pid, int exitstatus)
/*------
translator: %s is a noun phrase describing a child process, such as
"server process" */
- (errmsg("%s (PID %d) was terminated by signal %d: %s",
+ (errmsg("process %s (PID %d) was terminated by signal %d: %s",
procname, pid, WTERMSIG(exitstatus),
pg_strsignal(WTERMSIG(exitstatus))),
activity ? errdetail("Failed process was running: %s", activity) : 0));
@@ -2867,7 +2867,7 @@ LogChildExit(int lev, const char *procname, int pid, int exitstatus)
/*------
translator: %s is a noun phrase describing a child process, such as
"server process" */
- (errmsg("%s (PID %d) exited with unrecognized status %d",
+ (errmsg("process %s (PID %d) exited with unrecognized status %d",
procname, pid, exitstatus),
activity ? errdetail("Failed process was running: %s", activity) : 0));
}
--
2.39.5