Re: Cache invalidation bug in RelationGetIndexAttrBitmap()

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tomas Vondra <tv(at)fuzzy(dot)cz>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Cache invalidation bug in RelationGetIndexAttrBitmap()
Date: 2014-05-14 16:23:23
Message-ID: 20140514162323.GH23943@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-05-14 12:15:27 -0400, Tom Lane wrote:
> Andres Freund <andres(at)2ndquadrant(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2014-05-14 16:40:04 Re: 9.4 release notes
Previous Message Bruce Momjian 2014-05-14 16:21:11 Re: Typo in release notes