1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-08 11:42:09 +03:00

Modify elog() logic so that it won't try to longjmp(Warn_restart) before

Warn_restart has been set by the backend main loop.  This means that
elog(ERROR) or elog(FATAL) in the postmaster or during backend startup
now have well-defined behavior: proc_exit() rather than coredump.
In the case of elog() inside the postmaster, I think that proc_exit()
is probably not enough --- don't we want our child backends to be
forced to quit too?  But I don't understand Vadim's recent changes in
this area, so I'll leave it to him to look over and tweak if needed.
This commit is contained in:
Tom Lane
1999-11-16 06:13:36 +00:00
parent dc5c7713bc
commit e1492cc34c
3 changed files with 22 additions and 14 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.50 1999/10/25 03:07:50 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.51 1999/11/16 06:13:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -378,12 +378,13 @@ elog(int lev, const char *fmt, ...)
}
InError = true;
ProcReleaseSpins(NULL); /* get rid of spinlocks we hold */
if (lev == FATAL)
if (! Warn_restart_ready)
{
if (IsInitProcessingMode())
ExitPostgres(0);
ExitAfterAbort = true;
/* error reported before there is a main loop to return to */
elog(REALLYFATAL, "elog: error in postmaster or backend startup, giving up!");
}
if (lev == FATAL)
ExitAfterAbort = true;
/* exit to main loop */
siglongjmp(Warn_restart, 1);
}
@ -393,6 +394,9 @@ elog(int lev, const char *fmt, ...)
/*
* Serious crash time. Postmaster will observe nonzero
* process exit status and kill the other backends too.
*
* XXX: what if we are *in* the postmaster? proc_exit()
* won't kill our children...
*/
fflush(stdout);
fflush(stderr);