1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

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.
This commit is contained in:
Robert Haas
2010-11-25 00:06:46 -05:00
parent 58dfb07b5d
commit c2281ac87c
2 changed files with 23 additions and 19 deletions

View File

@ -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
}