Re: Cache invalidation bug in RelationGetIndexAttrBitmap() - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Cache invalidation bug in RelationGetIndexAttrBitmap()
Date
Msg-id 20140514162323.GH23943@awork2.anarazel.de
Whole thread Raw
In response to Re: Cache invalidation bug in RelationGetIndexAttrBitmap()  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Cache invalidation bug in RelationGetIndexAttrBitmap()
List pgsql-hackers
On 2014-05-14 12:15:27 -0400, Tom Lane wrote:
> Andres Freund <andres@2ndquadrant.com> writes:
> > On 2014-05-14 15:17:39 +0200, Andres Freund wrote:
> >> My gut feeling says it's in RelationGetIndexList().
> 
> > Nearly right. It's in RelationGetIndexAttrBitmap(). Fix attached.
> 
> TBH, I don't believe this patch at all.  Where exactly is rd_replidindex
> reset?  If it's supposed to have similar lifespan to, say, rd_oidindex,
> why isn't it being handled like rd_oidindex? 

I don't see why it'd have a different lifespan than rd_oidindex at all?
If the latter were used inside the loop it'd be a bug as well.

> And why does the header
> comment for RelationGetIndexList make no mention of this new side-effect?
> Somebody did a seriously poor job of adding this functionality to
> relcache.

It's not like it's not documented: There's a comment about it in struct
RelationData. I must have missed that rd_oidindex has a comment abou
it's lifetime over RelationGetIndexList().
I personally actually prefer the struct as the location for the
lifetime. I can send a patch to commonalize the location in either place
with the other location pointing to it.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Typo in release notes
Next
From: Dean Rasheed
Date:
Subject: Re: 9.4 release notes