Re: buffer assertion tripping under repeat pgbench load - Mailing list pgsql-hackers

From Greg Smith
Subject Re: buffer assertion tripping under repeat pgbench load
Date
Msg-id 50D75E8D.7020309@2ndQuadrant.com
Whole thread Raw
In response to Re: buffer assertion tripping under repeat pgbench load  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: buffer assertion tripping under repeat pgbench load  (Simon Riggs <simon@2ndQuadrant.com>)
List pgsql-hackers
On 12/23/12 1:10 PM, Tom Lane wrote:

> It might also be interesting to know if there is more than one
> still-pinned buffer --- that is, if you're going to hack the code, fix
> it to elog(LOG) each pinned buffer and then panic after completing the
> loop.


Easy enough; I kept it so the actual source of panic is still an 
assertion failure:

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



pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Review of Row Level Security
Next
From: Tom Lane
Date:
Subject: Re: pgcrypto seeding problem when ssl=on