Re: A note about hash-based catcache invalidations

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: A note about hash-based catcache invalidations
Date: 2011-08-17 20:02:18
Message-ID: 140.1313611338@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Wed, Aug 17, 2011 at 1:10 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> The plpython patch Jan just submitted reminds me that several of the PLs
>> detect whether they have obsolete cached data by noting whether the
>> tuple's xmin *and* TID are the same as previously seen.
>> Can anyone think of a situation this does not cover?

> What about this:

> 1. We cache the data, saving xmin X1 and TID T1.

> 2. VACUUM FULL moves the tuple to TID T2 but stores some other tuple in TID T1.

> 3. If the tuple that is now at TID T1 happens to have xmin = X1, we're
> in trouble.

No, because remember that we're also effectively demanding a match on
OID (because we fetch the tuple by OID to begin with) and that the tuple
be live (else we won't fetch it at all). There should not be another
live tuple with the same OID that vacuum could move to T1 --- if there
is, we've got worse problems than a broken caching check.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-08-17 20:04:55 Re: rc1 or beta4?
Previous Message Tom Lane 2011-08-17 19:55:03 Re: PATCH: Compiling PostgreSQL using ActiveState Python 3.2