Skip site navigation (1) Skip section navigation (2)

pgsql: Fix a problem introduced by my patch of 2010-01-12 that revised

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix a problem introduced by my patch of 2010-01-12 that revised
Date: 2010-04-14 21:31:27
Message-ID: 20100414213127.72FAA7541D0@cvs.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
Fix a problem introduced by my patch of 2010-01-12 that revised the way
relcache reload works.  In the patched code, a relcache entry in process of
being rebuilt doesn't get unhooked from the relcache hash table; which means
that if a cache flush occurs due to sinval queue overrun while we're
rebuilding it, the entry could get blown away by RelationCacheInvalidate,
resulting in crash or misbehavior.  Fix by ensuring that an entry being
rebuilt has positive refcount, so it won't be seen as a target for removal
if a cache flush occurs.  (This will mean that the entry gets rebuilt twice
in such a scenario, but that's okay.)  It appears that the problem can only
arise within a transaction that has previously reassigned the relfilenode of
a pre-existing table, via TRUNCATE or a similar operation.  Per bug #5412
from Rusty Conover.

Back-patch to 8.2, same as the patch that introduced the problem.
I think that the failure can't actually occur in 8.2, since it lacks the
rd_newRelfilenodeSubid optimization, but let's make it work like the later
branches anyway.

Patch by Heikki, slightly editorialized on by me.

Tags:
----
REL8_3_STABLE

Modified Files:
--------------
    pgsql/src/backend/utils/cache:
        relcache.c (r1.266.2.8 -> r1.266.2.9)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/cache/relcache.c?r1=1.266.2.8&r2=1.266.2.9)

pgsql-committers by date

Next:From: Tom LaneDate: 2010-04-14 21:31:33
Subject: pgsql: Fix a problem introduced by my patch of 2010-01-12 that revised
Previous:From: Tom LaneDate: 2010-04-14 21:31:20
Subject: pgsql: Fix a problem introduced by my patch of 2010-01-12 that revised

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group