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

Re: Buffer access rules, and a probable bug

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Buffer access rules, and a probable bug
Date: 2001-07-03 21:11:46
Message-ID: 25703.994194706@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
ncm(at)zembu(dot)com (Nathan Myers) writes:
> On Mon, Jul 02, 2001 at 09:40:25PM -0400, Tom Lane wrote:
>> 4. It is considered OK to update tuple commit status bits (ie, OR the
>> values HEAP_XMIN_COMMITTED, HEAP_XMIN_INVALID, HEAP_XMAX_COMMITTED, or
>> HEAP_XMAX_INVALID into t_infomask) while holding only a shared lock and
>> pin on a buffer.  This is OK because another backend looking at the tuple
>> at about the same time would OR the same bits into the field, so there
>> is little or no risk of conflicting update; what's more, if there did
>> manage to be a conflict it would merely mean that one bit-update would
>> be lost and need to be done again later.

> Without looking at the code, this seems mad.  Are you sure?

Yes.  Those status bits aren't ground truth, only hints.  They cache the
results of looking up transaction status in pg_log; if they get dropped,
the only consequence is the next visitor to the tuple has to do the
lookup over again.

Changing any other bits in t_infomask requires exclusive lock, however.

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2001-07-03 21:14:23
Subject: Re: funny (cache (?)) bug in postgres (7.x tested)
Previous:From: Jan WieckDate: 2001-07-03 21:03:57
Subject: Re: funny (cache (?)) bug in postgres (7.x tested)

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