More startup/shutdown log messages.

This commit is contained in:
Vadim B. Mikheev 1999-10-08 02:16:22 +00:00
parent b1ec184d38
commit c528c42ec2
1 changed files with 43 additions and 10 deletions

View File

@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.122 1999/10/06 22:44:25 vadim Exp $ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.123 1999/10/08 02:16:22 vadim Exp $
* *
* NOTES * NOTES
* *
@ -174,6 +174,8 @@ static char *progname = (char *) NULL;
static char **real_argv; static char **real_argv;
static int real_argc; static int real_argc;
static time_t tnow;
/* /*
* Default Values * Default Values
*/ */
@ -1208,6 +1210,9 @@ pmdie(SIGNAL_ARGS)
if (Shutdown >= SmartShutdown) if (Shutdown >= SmartShutdown)
return; return;
Shutdown = SmartShutdown; Shutdown = SmartShutdown;
tnow = time(NULL);
fprintf(stderr, "Smart Shutdown request at %s", ctime(&tnow));
fflush(stderr);
if (DLGetHead(BackendList)) /* let reaper() handle this */ if (DLGetHead(BackendList)) /* let reaper() handle this */
return; return;
/* /*
@ -1230,11 +1235,18 @@ pmdie(SIGNAL_ARGS)
*/ */
if (Shutdown >= FastShutdown) if (Shutdown >= FastShutdown)
return; return;
tnow = time(NULL);
fprintf(stderr, "Fast Shutdown request at %s", ctime(&tnow));
fflush(stderr);
if (DLGetHead(BackendList)) /* let reaper() handle this */ if (DLGetHead(BackendList)) /* let reaper() handle this */
{ {
Shutdown = FastShutdown; Shutdown = FastShutdown;
if (!FatalError) if (!FatalError)
{
fprintf(stderr, "Aborting any active transaction...\n");
fflush(stderr);
SignalChildren(SIGTERM); SignalChildren(SIGTERM);
}
return; return;
} }
if (Shutdown > NoShutdown) if (Shutdown > NoShutdown)
@ -1261,6 +1273,9 @@ pmdie(SIGNAL_ARGS)
* abort all children with SIGUSR1 and exit without * abort all children with SIGUSR1 and exit without
* attempt to properly shutdown data base system. * attempt to properly shutdown data base system.
*/ */
tnow = time(NULL);
fprintf(stderr, "Immediate Shutdown request at %s", ctime(&tnow));
fflush(stderr);
if (ShutdownPID > 0) if (ShutdownPID > 0)
kill(ShutdownPID, SIGQUIT); kill(ShutdownPID, SIGQUIT);
else if (StartupPID > 0) else if (StartupPID > 0)
@ -1308,7 +1323,11 @@ reaper(SIGNAL_ARGS)
if (pid != ShutdownPID) if (pid != ShutdownPID)
abort(); abort();
if (exitstatus != 0) if (exitstatus != 0)
abort(); {
fprintf(stderr, "Shutdown failed - abort\n");
fflush(stderr);
proc_exit(1);
}
proc_exit(0); proc_exit(0);
} }
if (StartupPID > 0) if (StartupPID > 0)
@ -1316,7 +1335,11 @@ reaper(SIGNAL_ARGS)
if (pid != StartupPID) if (pid != StartupPID)
abort(); abort();
if (exitstatus != 0) if (exitstatus != 0)
abort(); {
fprintf(stderr, "Startup failed - abort\n");
fflush(stderr);
proc_exit(1);
}
StartupPID = 0; StartupPID = 0;
FatalError = false; FatalError = false;
if (Shutdown > NoShutdown) if (Shutdown > NoShutdown)
@ -1341,9 +1364,11 @@ reaper(SIGNAL_ARGS)
return; return;
if (StartupPID > 0 || ShutdownPID > 0) if (StartupPID > 0 || ShutdownPID > 0)
return; return;
if (DebugLvl) tnow = time(NULL);
fprintf(stderr, "%s: CleanupProc: reinitializing shared memory and semaphores\n", fprintf(stderr, "Server processes were terminated at %s"
progname); "Reinitializing shared memory and semaphores\n",
ctime(&tnow));
fflush(stderr);
shmem_exit(0); shmem_exit(0);
reset_shared(PostPortName); reset_shared(PostPortName);
StartupPID = StartupDataBase(); StartupPID = StartupDataBase();
@ -1410,6 +1435,14 @@ CleanupProc(int pid,
return; return;
} }
if (!FatalError)
{
tnow = time(NULL);
fprintf(stderr, "Server process (pid %d) exited with status %d at %s"
"Terminating any active server processes...\n",
pid, exitstatus, ctime(&tnow));
fflush(stderr);
}
FatalError = true; FatalError = true;
curr = DLGetHead(BackendList); curr = DLGetHead(BackendList);
while (curr) while (curr)