diff options
author | Robert Haas <rhaas@postgresql.org> | 2010-11-25 00:06:46 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2010-11-25 00:06:46 -0500 |
commit | c2281ac87cf4828b6b828dc8585a10aeb3a176e0 (patch) | |
tree | a90d6e3c86f25ba6d6dbcbcf25ab006689ff0044 /src/backend/storage/buffer/bufmgr.c | |
parent | 58dfb07b5d84c0088033e2d22fc44df812fa6eb5 (diff) |
Remove belt-and-suspenders guards against buffer pin leaks.
Forcibly releasing all leftover buffer pins should be unnecessary now
that we have a robust ResourceOwner mechanism, and it significantly
increases the cost of process shutdown. Instead, in an assert-enabled
build, assert that no pins are held; in a non-assert-enabled build, do
nothing.
Diffstat (limited to 'src/backend/storage/buffer/bufmgr.c')
-rw-r--r-- | src/backend/storage/buffer/bufmgr.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 54c7109983d..edc497788df 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1659,31 +1659,26 @@ InitBufferPoolBackend(void) } /* - * Ensure we have released all shared-buffer locks and pins during backend exit + * During backend exit, ensure that we released all shared-buffer locks and + * assert that we have no remaining pins. */ static void AtProcExit_Buffers(int code, Datum arg) { - int i; - AbortBufferIO(); UnlockBuffers(); - for (i = 0; i < NBuffers; i++) +#ifdef USE_ASSERT_CHECKING + if (assert_enabled) { - if (PrivateRefCount[i] != 0) - { - volatile BufferDesc *buf = &(BufferDescriptors[i]); + int i; - /* - * We don't worry about updating ResourceOwner; if we even got - * here, it suggests that ResourceOwners are messed up. - */ - PrivateRefCount[i] = 1; /* make sure we release shared pin */ - UnpinBuffer(buf, false); + for (i = 0; i < NBuffers; i++) + { Assert(PrivateRefCount[i] == 0); } } +#endif /* localbuf.c needs a chance too */ AtProcExit_LocalBuffers(); |