OSDN Git Service

When loading critical system indexes into the relcache, ensure we lock the
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 13 Jan 2010 23:07:08 +0000 (23:07 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 13 Jan 2010 23:07:08 +0000 (23:07 +0000)
commit715120e7ac9f80eec4e5d5c011cd151675ad59d1
tree4537abd06d966fed9266d79f7ce1d3a7d2b37460
parentdbba3a1465472bda66265e6a38fd24cbe619f233
When loading critical system indexes into the relcache, ensure we lock the
underlying catalog not only the index itself.  Otherwise, if the cache
load process touches the catalog (which will happen for many though not
all of these indexes), we are locking index before parent table, which can
result in a deadlock against processes that are trying to lock them in the
normal order.  Per today's failure on buildfarm member gothic_moth; it's
surprising the problem hadn't been identified before.

Back-patch to 8.2.  Earlier releases didn't have the issue because they
didn't try to lock these indexes during load (instead assuming that they
couldn't change schema at all during multiuser operation).
src/backend/utils/cache/relcache.c