Re: Bug in new buffer freelist code - Mailing list pgsql-hackers

From Jan Wieck
Subject Re: Bug in new buffer freelist code
Date
Msg-id 3FFC421A.6040408@Yahoo.com
Whole thread Raw
In response to Re: Bug in new buffer freelist code  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@Yahoo.com #



pgsql-hackers by date:

Previous
From: Andreas Pflug
Date:
Subject: Re: Brokenness in parsing of pg_hba.conf
Next
From: Neil Conway
Date:
Subject: Re: Bug in new buffer freelist code