| From: | Simon Riggs <simon(at)2ndQuadrant(dot)com> | 
|---|---|
| To: | Greg Smith <greg(at)2ndquadrant(dot)com> | 
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: buffer assertion tripping under repeat pgbench load | 
| Date: | 2012-12-23 20:17:31 | 
| Message-ID: | CA+U5nM+sVMCNFJCnndZVvgzG=MrWvZ6SWTEHA33bjGqm96e0Uw@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On 23 December 2012 19:42, Greg Smith <greg(at)2ndquadrant(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert Haas | 2012-12-23 21:00:56 | Re: Making view dump/restore safe at the column-alias level | 
| Previous Message | Tom Lane | 2012-12-23 19:54:10 | Re: pgcrypto seeding problem when ssl=on |