diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-09-25 20:31:40 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-09-25 20:31:40 +0000 |
commit | 8a6fab412e35d8495201a13d8258f26b730306f5 (patch) | |
tree | b80702276508960201ba5211b96de8c646dd76f3 /src/backend/storage/buffer/buf_init.c | |
parent | 691aefcf4294c8262a8bf89258250470be1046a6 (diff) | |
download | postgresql-8a6fab412e35d8495201a13d8258f26b730306f5.tar.gz postgresql-8a6fab412e35d8495201a13d8258f26b730306f5.zip |
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.
Diffstat (limited to 'src/backend/storage/buffer/buf_init.c')
-rw-r--r-- | src/backend/storage/buffer/buf_init.c | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/src/backend/storage/buffer/buf_init.c b/src/backend/storage/buffer/buf_init.c index dd6478c195d..3d25381c14d 100644 --- a/src/backend/storage/buffer/buf_init.c +++ b/src/backend/storage/buffer/buf_init.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.52 2002/09/04 20:31:25 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.53 2002/09/25 20:31:40 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -35,8 +35,6 @@ #include "utils/memutils.h" -static void ShutdownBufferPoolAccess(void); - /* * if BMTRACE is defined, we trace the last 200 buffer allocations and * deallocations in a circular buffer in shared memory. @@ -219,6 +217,10 @@ InitBufferPool(void) * This is called during backend startup (whether standalone or under the * postmaster). It sets up for this backend's access to the already-existing * buffer pool. + * + * NB: this is called before InitProcess(), so we do not have a PGPROC and + * cannot do LWLockAcquire; hence we can't actually access the bufmgr's + * shared memory yet. We are only initializing local data here. */ void InitBufferPoolAccess(void) @@ -238,27 +240,6 @@ InitBufferPoolAccess(void) */ for (i = 0; i < NBuffers; i++) BufferBlockPointers[i] = (Block) MAKE_PTR(BufferDescriptors[i].data); - - /* - * Now that buffer access is initialized, set up a callback to shut it - * down again at backend exit. - */ - on_shmem_exit(ShutdownBufferPoolAccess, 0); -} - -/* - * Shut down buffer manager at backend exit. - * - * This is needed mainly to ensure that we don't leave any buffer reference - * counts set during an error exit. - */ -static void -ShutdownBufferPoolAccess(void) -{ - /* Release any buffer context locks we are holding */ - UnlockBuffers(); - /* Release any buffer reference counts we are holding */ - AtEOXact_Buffers(false); } /* ----------------------------------------------------- |