Re: Segmentation fault in 7.3 while vacuuming - Mailing list pgsql-general

From Tom Lane
Subject Re: Segmentation fault in 7.3 while vacuuming
Date
Msg-id 5620.1039128708@sss.pgh.pa.us
Whole thread Raw
In response to Re: Segmentation fault in 7.3 while vacuuming  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
I said:
> Frank van Vugt <ftm.van.vugt@foxi.nl> writes:
>> ** while using a client written in TrollTech's QT v3.1 that creates a number
>> of temporary tables, uses a number lot of 'copy' statements and at the end
>> tries to 'vacuum full analyse' the database

> Drat --- looks like the local buffer manager code has gotten out of sync
> with the relcache code.

Here is the fix if you need to patch this locally.

            regards, tom lane


*** src/backend/storage/buffer/localbuf.c.orig    Wed Sep  4 16:31:25 2002
--- src/backend/storage/buffer/localbuf.c    Thu Dec  5 17:48:10 2002
***************
*** 90,108 ****
      {
          Relation    bufrel = RelationNodeCacheGetRelation(bufHdr->tag.rnode);

-         /*
-          * The relcache is not supposed to throw away temp rels, so this
-          * should always succeed.
-          */
-         Assert(bufrel != NULL);
-
          /* flush this page */
!         smgrwrite(DEFAULT_SMGR, bufrel, bufHdr->tag.blockNum,
!                   (char *) MAKE_PTR(bufHdr->data));
!         LocalBufferFlushCount++;

!         /* drop refcount incremented by RelationNodeCacheGetRelation */
!         RelationDecrementReferenceCount(bufrel);
      }

      /*
--- 90,113 ----
      {
          Relation    bufrel = RelationNodeCacheGetRelation(bufHdr->tag.rnode);

          /* flush this page */
!         if (bufrel == (Relation) NULL)
!         {
!             smgrblindwrt(DEFAULT_SMGR,
!                          bufHdr->tag.rnode,
!                          bufHdr->tag.blockNum,
!                          (char *) MAKE_PTR(bufHdr->data));
!         }
!         else
!         {
!             smgrwrite(DEFAULT_SMGR, bufrel,
!                       bufHdr->tag.blockNum,
!                       (char *) MAKE_PTR(bufHdr->data));
!             /* drop refcount incremented by RelationNodeCacheGetRelation */
!             RelationDecrementReferenceCount(bufrel);
!         }

!         LocalBufferFlushCount++;
      }

      /*

pgsql-general by date:

Previous
From: "Al Bean"
Date:
Subject: the "/usr/local/pgsql/data" directory size
Next
From: "David Blood"
Date:
Subject: Re: Size for vacuum_mem