Re: advancing snapshot's xmin - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: advancing snapshot's xmin
Date
Msg-id 47E99999.4010300@enterprisedb.com
Whole thread Raw
In response to Re: advancing snapshot's xmin  (Neil Conway <neilc@samurai.com>)
Responses Re: advancing snapshot's xmin  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Neil Conway wrote:
> On Tue, 2008-03-25 at 17:26 -0300, Alvaro Herrera wrote:
>> There is one hole here: contention on ProcArrayLock.  Basically, for
>> simple transactions we will need to update MyProc after every command.
> 
> If we're just updating MyProc->xmin, we only need to acquire
> ProcArrayLock in shared mode, right?

In fact, do you need a lock at all? We already assume that 
reading/writing a TransactionId is atomic in many places. We acquire 
ProcArrayLock at the end of transaction when we clear MyProc->xid, to 
ensure that we don't exit the set of running transactions while someone 
else is taking a snapshot, but AFAICS that's not necessary when we just 
advance MyProc->xmin.

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATCHES] Text <-> C string
Next
From: Gregory Stark
Date:
Subject: Re: writing a MIN(RECORD) aggregate