Re: Segmentation fault in 7.3 while vacuuming

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Frank van Vugt <ftm(dot)van(dot)vugt(at)foxi(dot)nl>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: Segmentation fault in 7.3 while vacuuming
Date: 2002-12-05 22:51:48
Message-ID: 5620.1039128708@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-advocacy pgsql-general pgsql-hackers

I said:
> Frank van Vugt <ftm(dot)van(dot)vugt(at)foxi(dot)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++;
}

/*

In response to

Browse pgsql-advocacy by date

  From Date Subject
Next Message Josh Berkus 2002-12-05 23:37:28 Re: [GENERAL] PostgreSQL Global Development Group
Previous Message Christopher Kings-Lynne 2002-12-05 19:28:16 Case Studies

Browse pgsql-general by date

  From Date Subject
Next Message David Blood 2002-12-05 23:11:35 Re: Size for vacuum_mem
Previous Message Al Bean 2002-12-05 22:02:53 the "/usr/local/pgsql/data" directory size

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeroen T. Vermeulen 2002-12-05 23:05:14 Re: PQnotifies() in 7.3 broken?
Previous Message Justin Clift 2002-12-05 22:32:49 Re: Shrinkwrap Windows Product, any issues? Anyone? (postmaster