mirror of
https://github.com/postgres/postgres.git
synced 2025-05-03 22:24:49 +03:00
Restructure child-exit logging messages for easier translation,
per suggestion from Peter.
This commit is contained in:
parent
ec438886e1
commit
0c1669c806
@ -37,7 +37,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.258 2001/11/06 18:02:48 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.259 2001/11/10 23:06:12 tgl Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
*
|
*
|
||||||
@ -240,7 +240,7 @@ static void reaper(SIGNAL_ARGS);
|
|||||||
static void sigusr1_handler(SIGNAL_ARGS);
|
static void sigusr1_handler(SIGNAL_ARGS);
|
||||||
static void dummy_handler(SIGNAL_ARGS);
|
static void dummy_handler(SIGNAL_ARGS);
|
||||||
static void CleanupProc(int pid, int exitstatus);
|
static void CleanupProc(int pid, int exitstatus);
|
||||||
static const char *formatExitStatus(int exitstatus);
|
static void LogChildExit(const char *procname, int pid, int exitstatus);
|
||||||
static int DoBackend(Port *port);
|
static int DoBackend(Port *port);
|
||||||
static void ExitPostmaster(int status);
|
static void ExitPostmaster(int status);
|
||||||
static void usage(const char *);
|
static void usage(const char *);
|
||||||
@ -1544,8 +1544,8 @@ reaper(SIGNAL_ARGS)
|
|||||||
*/
|
*/
|
||||||
if (pgstat_ispgstat(pid))
|
if (pgstat_ispgstat(pid))
|
||||||
{
|
{
|
||||||
elog(DEBUG, "statistics collector process (pid %d) %s",
|
LogChildExit(gettext("statistics collector process"),
|
||||||
pid, formatExitStatus(exitstatus));
|
pid, exitstatus);
|
||||||
pgstat_start();
|
pgstat_start();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1557,8 +1557,8 @@ reaper(SIGNAL_ARGS)
|
|||||||
{
|
{
|
||||||
if (exitstatus != 0)
|
if (exitstatus != 0)
|
||||||
{
|
{
|
||||||
elog(DEBUG, "shutdown process (pid %d) %s",
|
LogChildExit(gettext("shutdown process"),
|
||||||
pid, formatExitStatus(exitstatus));
|
pid, exitstatus);
|
||||||
ExitPostmaster(1);
|
ExitPostmaster(1);
|
||||||
}
|
}
|
||||||
ExitPostmaster(0);
|
ExitPostmaster(0);
|
||||||
@ -1568,8 +1568,9 @@ reaper(SIGNAL_ARGS)
|
|||||||
{
|
{
|
||||||
if (exitstatus != 0)
|
if (exitstatus != 0)
|
||||||
{
|
{
|
||||||
elog(DEBUG, "startup process (pid %d) %s; aborting startup",
|
LogChildExit(gettext("startup process"),
|
||||||
pid, formatExitStatus(exitstatus));
|
pid, exitstatus);
|
||||||
|
elog(DEBUG, "aborting startup due to startup process failure");
|
||||||
ExitPostmaster(1);
|
ExitPostmaster(1);
|
||||||
}
|
}
|
||||||
StartupPID = 0;
|
StartupPID = 0;
|
||||||
@ -1639,8 +1640,6 @@ reaper_done:
|
|||||||
* CleanupProc -- cleanup after terminated backend.
|
* CleanupProc -- cleanup after terminated backend.
|
||||||
*
|
*
|
||||||
* Remove all local state associated with backend.
|
* Remove all local state associated with backend.
|
||||||
*
|
|
||||||
* Dillon's note: should log child's exit status in the system log.
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
CleanupProc(int pid,
|
CleanupProc(int pid,
|
||||||
@ -1651,8 +1650,7 @@ CleanupProc(int pid,
|
|||||||
Backend *bp;
|
Backend *bp;
|
||||||
|
|
||||||
if (DebugLvl)
|
if (DebugLvl)
|
||||||
elog(DEBUG, "CleanupProc: child process (pid %d) %s",
|
LogChildExit(gettext("child process"), pid, exitstatus);
|
||||||
pid, formatExitStatus(exitstatus));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If a backend dies in an ugly way (i.e. exit status not 0) then we
|
* If a backend dies in an ugly way (i.e. exit status not 0) then we
|
||||||
@ -1697,8 +1695,7 @@ CleanupProc(int pid,
|
|||||||
/* Make log entry unless we did so already */
|
/* Make log entry unless we did so already */
|
||||||
if (!FatalError)
|
if (!FatalError)
|
||||||
{
|
{
|
||||||
elog(DEBUG, "server process (pid %d) %s",
|
LogChildExit(gettext("server process"), pid, exitstatus);
|
||||||
pid, formatExitStatus(exitstatus));
|
|
||||||
elog(DEBUG, "terminating any other active server processes");
|
elog(DEBUG, "terminating any other active server processes");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1756,33 +1753,24 @@ CleanupProc(int pid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert a wait(2) exit status into a printable string.
|
* Log the death of a child process.
|
||||||
*
|
|
||||||
* For present uses, it's okay to use a static return area here.
|
|
||||||
*/
|
*/
|
||||||
static const char *
|
static void
|
||||||
formatExitStatus(int exitstatus)
|
LogChildExit(const char *procname, int pid, int exitstatus)
|
||||||
{
|
{
|
||||||
static char result[100];
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* translator: these strings provide the verb phrase in the preceding
|
* translator: the first %s in these messages is a noun phrase
|
||||||
* messages such as "server process (pid %d) %s"
|
* describing a child process, such as "server process"
|
||||||
*/
|
*/
|
||||||
if (WIFEXITED(exitstatus))
|
if (WIFEXITED(exitstatus))
|
||||||
snprintf(result, sizeof(result),
|
elog(DEBUG, "%s (pid %d) exited with exit code %d",
|
||||||
gettext("exited with exit code %d"),
|
procname, pid, WEXITSTATUS(exitstatus));
|
||||||
WEXITSTATUS(exitstatus));
|
|
||||||
else if (WIFSIGNALED(exitstatus))
|
else if (WIFSIGNALED(exitstatus))
|
||||||
snprintf(result, sizeof(result),
|
elog(DEBUG, "%s (pid %d) was terminated by signal %d",
|
||||||
gettext("was terminated by signal %d"),
|
procname, pid, WTERMSIG(exitstatus));
|
||||||
WTERMSIG(exitstatus));
|
|
||||||
else
|
else
|
||||||
snprintf(result, sizeof(result),
|
elog(DEBUG, "%s (pid %d) exited with unexpected status %d",
|
||||||
gettext("exited with unexpected status %d"),
|
procname, pid, exitstatus);
|
||||||
exitstatus);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user