diff options
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 } |