On 23 December 2012 19:42, Greg Smith <greg@2ndquadrant.com> wrote:
> diff --git a/src/backend/storage/buffer/bufmgr.c
> b/src/backend/storage/buffer/bufmgr.c
> index dddb6c0..df43643 100644
> --- a/src/backend/storage/buffer/bufmgr.c
> +++ b/src/backend/storage/buffer/bufmgr.c
> @@ -1697,11 +1697,21 @@ AtEOXact_Buffers(bool isCommit)
> if (assert_enabled)
> {
> int i;
> + int RefCountErrors = 0;
>
>
> for (i = 0; i < NBuffers; i++)
> {
> - Assert(PrivateRefCount[i] == 0);
> +
> + if (PrivateRefCount[i] != 0)
> + {
> + BufferDesc *bufHdr = &BufferDescriptors[i];
> + elog(LOG, "refcount of %s is %u should be 0,
> globally: %u",
>
> + relpathbackend(bufHdr->tag.rnode,
> InvalidBackendId, bufHdr->tag.forkNum),
> + PrivateRefCount[i], bufHdr->refcount);
> + RefCountErrors++;
> + }
> }
> + Assert(RefCountErrors == 0);
> }
> #endif
>
We already have PrintBufferLeakWarning() for this, which might be a bit neater.
If that last change was the cause, then its caused within VACUUM. I'm
running a thrash test with autovacuums set much more frequently but
nothing yet.
Are you by any chance running with unlogged tables? There was a change
there recently, something around checkpoint IIRC. Can you set
checkpoints more frequent also?
-- Simon Riggs http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services