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/localbuf.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/localbuf.c')
-rw-r--r-- | src/backend/storage/buffer/localbuf.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c index 46fddde187b..059c7f18477 100644 --- a/src/backend/storage/buffer/localbuf.c +++ b/src/backend/storage/buffer/localbuf.c @@ -468,14 +468,23 @@ AtEOXact_LocalBuffers(bool isCommit) /* * AtProcExit_LocalBuffers - ensure we have dropped pins during backend exit. * - * This is just like AtProcExit_Buffers, but for local buffers. We have - * to drop pins to ensure that any attempt to drop temp files doesn't - * fail in DropRelFileNodeBuffers. + * This is just like AtProcExit_Buffers, but for local buffers. We shouldn't + * be holding any remaining pins; if we are, and assertions aren't enabled, + * we'll fail later in DropRelFileNodeBuffers while trying to drop the temp + * rels. */ void AtProcExit_LocalBuffers(void) { - /* just zero the refcounts ... */ - if (LocalRefCount) - MemSet(LocalRefCount, 0, NLocBuffer * sizeof(*LocalRefCount)); +#ifdef USE_ASSERT_CHECKING + if (assert_enabled && LocalRefCount) + { + int i; + + for (i = 0; i < NLocBuffer; i++) + { + Assert(LocalRefCount[i] == 0); + } + } +#endif } |