mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
Remove ShutdownBufferPoolAccess exit callback, and do the work in
ProcKill instead, where we still have a PGPROC with which to wait on LWLocks. This fixes 'can't wait without a PROC structure' failures occasionally seen during backend shutdown (I'm surprised they weren't more frequent, actually). Add an Assert() to LWLockAcquire to help catch any similar mistakes in future. Fix failure to update MyProcPid for standalone backends and pgstat processes.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.125 2002/09/04 20:31:26 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.126 2002/09/25 20:31:40 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -391,8 +391,15 @@ ProcKill(void)
|
||||
/* Release any LW locks I am holding */
|
||||
LWLockReleaseAll();
|
||||
|
||||
/* Abort any buffer I/O in progress */
|
||||
/*
|
||||
* Make real sure we release any buffer locks and pins we might be
|
||||
* holding, too. It is pretty ugly to do this here and not in a
|
||||
* shutdown callback registered by the bufmgr ... but we must do this
|
||||
* *after* LWLockReleaseAll and *before* zapping MyProc.
|
||||
*/
|
||||
AbortBufferIO();
|
||||
UnlockBuffers();
|
||||
AtEOXact_Buffers(false);
|
||||
|
||||
/* Get off any wait queue I might be on */
|
||||
LockWaitCancel();
|
||||
@@ -430,8 +437,10 @@ DummyProcKill(void)
|
||||
/* Release any LW locks I am holding */
|
||||
LWLockReleaseAll();
|
||||
|
||||
/* Abort any buffer I/O in progress */
|
||||
/* Release buffer locks and pins, too */
|
||||
AbortBufferIO();
|
||||
UnlockBuffers();
|
||||
AtEOXact_Buffers(false);
|
||||
|
||||
/* I can't be on regular lock queues, so needn't check */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user