Re: Bug in new buffer freelist code

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Bug in new buffer freelist code
Date: 2004-01-07 17:30:02
Message-ID: 3FFC421A.6040408@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:

> Note that buffer 160 gets cleared twice in this sequence. The second
> time, the CDB for 174 gets found, leading to failure when 174 is cleared.
>
> I believe the correct fix is to do CLEAR_BUFFERTAG on the buffer (and
> maybe the CDB too?) when returning a buffer to the freelist in
> StrategyInvalidateBuffer. It might also be worthwhile to add another
> BM_FLAG bit that specifically indicates a buffer is on the freelist,
> and set/clear/test that at appropriate spots.

That was the place I intended to do it.

>
> I am actually of the opinion that the assertion code at the bottom of
> StrategyInvalidateBuffer is all wrong: it should *never* be possible
> to call StrategyInvalidateBuffer on something that's already in the
> freelist, and the only reason you had that in there was because of
> this mistaken failure to clear the buffertag, leading to wrong calls
> from linear searches of the buffer array. I think you should just
> elog(ERROR) any time you fail to find a CDB in this routine.

That is corrent.

Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2004-01-07 17:42:31 Re: Brokenness in parsing of pg_hba.conf
Previous Message Bruno Wolff III 2004-01-07 17:27:55 Re: [COMMITTERS] pgsql-server/ oc/src/sgml/catalogs.sgml rc/bac ...