Re: buffer assertion tripping under repeat pgbench load
Simon Riggs <simon@2ndquadrant.com>
From: Simon Riggs <simon@2ndQuadrant.com>
To: Greg Smith <greg@2ndquadrant.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Andres Freund <andres@2ndquadrant.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2012-12-23T20:17:31Z
Lists: pgsql-hackers
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
Commits
-
Follow TLI of last replayed record, not recovery target TLI, in walsenders.
- af275a12dfee 9.3.0 cited
-
Avoid holding vmbuffer pin after VACUUM.
- 62656617dbe4 9.3.0 cited