*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.136 1999/10/25 03:07:48 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.137 1999/11/16 06:13:35 tgl Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
/* note: these declarations had better match tcopprot.h */
DLLIMPORT sigjmp_buf Warn_restart;
+bool Warn_restart_ready = false;
bool InError = false;
bool ExitAfterAbort = false;
* Some backend has bought the farm,
* so we need to stop what we're doing and exit.
*
- * die() performs an orderly cleanup via ExitPostgres()
+ * die() performs an orderly cleanup via proc_exit()
* --------------------------------
*/
/*
- * DO NOT ExitPostgres(0) -- we're here because shared memory may be
+ * DO NOT proc_exit(0) -- we're here because shared memory may be
* corrupted, so we don't want to flush any shared state to stable
* storage. Just nail the windows shut and get out of town.
*/
if (!IsUnderPostmaster)
{
puts("\nPOSTGRES backend interactive interface ");
- puts("$Revision: 1.136 $ $Date: 1999/10/25 03:07:48 $\n");
+ puts("$Revision: 1.137 $ $Date: 1999/11/16 06:13:35 $\n");
}
/*
* Initialize the deferred trigger manager
*/
if (DeferredTriggerInit() != 0)
- ExitPostgres(1);
+ proc_exit(1);
+
+ SetProcessingMode(NormalProcessing);
/*
* POSTGRES main processing loop begins here
* so we abort the current transaction and start a new one.
*/
- SetProcessingMode(NormalProcessing);
-
if (sigsetjmp(Warn_restart, 1) != 0)
{
time(&tim);
if (ExitAfterAbort)
{
ProcReleaseLocks(); /* Just to be sure... */
- ExitPostgres(0);
+ proc_exit(0);
}
}
+ Warn_restart_ready = true; /* we can now handle elog(ERROR) */
+
PG_SETMASK(&UnBlockSig);
/*
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
}
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);
}
/*
* 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);
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: tcopprot.h,v 1.22 1999/10/06 21:58:18 vadim Exp $
+ * $Id: tcopprot.h,v 1.23 1999/11/16 06:13:34 tgl Exp $
*
* OLD COMMENTS
* This file was created so that other c files could get the two
#define siglongjmp longjmp
#endif
extern DLLIMPORT sigjmp_buf Warn_restart;
+extern bool Warn_restart_ready;
extern bool InError;
extern bool ExitAfterAbort;