1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-04 20:11:56 +03:00

Clean up backend-exit-time cleanup behavior. Use on_shmem_exit callbacks

to ensure that we have released buffer refcounts and so forth, rather than
putting ad-hoc operations before (some of the calls to) proc_exit.  Add
commentary to discourage future hackers from repeating that mistake.
This commit is contained in:
Tom Lane
2000-12-18 00:44:50 +00:00
parent 8c8ed4f456
commit a626b78c89
14 changed files with 255 additions and 139 deletions

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: elog.h,v 1.20 2000/12/06 17:25:45 tgl Exp $
* $Id: elog.h,v 1.21 2000/12/18 00:44:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,24 +28,24 @@ extern int Use_syslog;
#endif
/*
* If StopIfError > 0 signal handlers mustn't do
* If CritSectionCount > 0, signal handlers mustn't do
* elog(ERROR|FATAL), instead remember what action is
* required with QueryCancel & ExitAfterAbort.
* required with QueryCancel & ProcDiePending.
*/
extern uint32 StopIfError; /* duplicates access/xlog.h */
extern uint32 CritSectionCount; /* duplicates access/xlog.h */
extern bool QueryCancel; /* duplicates miscadmin.h */
extern bool ExitAfterAbort;
extern bool ProcDiePending;
#define START_CRIT_CODE (StopIfError++)
#define START_CRIT_CODE (CritSectionCount++)
#define END_CRIT_CODE \
do { \
if (!StopIfError) \
if (CritSectionCount == 0) \
elog(STOP, "Not in critical section"); \
StopIfError--; \
if (!StopIfError && QueryCancel) \
CritSectionCount--; \
if (CritSectionCount == 0 && QueryCancel) \
{ \
if (ExitAfterAbort) \
if (ProcDiePending) \
elog(FATAL, "The system is shutting down"); \
else \
elog(ERROR, "Query was cancelled."); \