aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/error/elog.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-11-16 06:13:36 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-11-16 06:13:36 +0000
commite1492cc34ca7bd31ba8ed30f8638b33bc28ae3fd (patch)
tree8e4eecc701ccb203ab5deb26ea46335c54e120f2 /src/backend/utils/error/elog.c
parentdc5c7713bcd620e4b8cee6c282e55afdd2a97749 (diff)
downloadpostgresql-e1492cc34ca7bd31ba8ed30f8638b33bc28ae3fd.tar.gz
postgresql-e1492cc34ca7bd31ba8ed30f8638b33bc28ae3fd.zip
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.
Diffstat (limited to 'src/backend/utils/error/elog.c')
-rw-r--r--src/backend/utils/error/elog.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 247cf1c724a..b8da26779b6 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -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);