Re: Race conditions in relcache load (again) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Race conditions in relcache load (again)
Date
Msg-id 14432.1208370382@sss.pgh.pa.us
Whole thread Raw
In response to Race conditions in relcache load (again)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I wrote:
> I realized that we failed to plug all the gaps of this type,
> because relcache.c contains *internal* cache load/reload operations
> that aren't protected.  In particular the LOAD_CRIT_INDEX macro
> calls invoke relcache load on indexes that aren't locked.  So they'd
> be at risk from a concurrent REINDEX or similar on those system
> indexes.  RelationReloadIndexInfo seems at risk as well.

On closer analysis, LOAD_CRIT_INDEX is clearly broken here, but the
other places I was worried about seem safe, because they are all
used to rebuild relcache entries that are being held open by
higher-level code; and the contract is that there should be a lock
protecting any open relcache entry.

I've committed a fix that adds locking to LOAD_CRIT_INDEX and adds
some comments about the other cases.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: How to submit a patch
Next
From: Heikki Linnakangas
Date:
Subject: Re: How to submit a patch