Re: SSI atomic commit - Mailing list pgsql-hackers

From Dan Ports
Subject Re: SSI atomic commit
Date
Msg-id 20110705195436.GB94047@csail.mit.edu
Whole thread Raw
In response to Re: SSI atomic commit  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
List pgsql-hackers
On Tue, Jul 05, 2011 at 01:15:13PM -0500, Kevin Grittner wrote:
> Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> wrote:
>  
> > Hmm, I think it would be simpler to decide that instead of 
> > SerializableXactHashLock, you must hold ProcArrayLock to access 
> > LastSxactCommitSeqNo, and move the assignment of commitSeqNo to 
> > ProcArrayTransaction(). It's probably easiest to move 
> > LastSxactCommitSeqno to ShmemVariableCache too. There's a few
> > places that would then need to acquire ProcArrayLock to read 
> > LastSxactCommitSeqno, but I feel it might still be much simpler
> > that way.
>  
> We considered that.  I think the biggest problem was that when there
> is no XID it wouldn't be covered by the lock on assignment.

One other issue is that after the sequence number is assigned, it still
needs to be stored in MySerializableXact->commitSeqNo. Modifying that
does require taking SerializableXactHashLock.

With the proposed patch, assigning the next commitSeqNo and storing it
in MySerializableXact happen atomically. That makes it possible to say
that a transaction that has a commitSeqNo must have committed before
one that doesn't. If the two steps are separated, that isn't true: two
transactions might get their commitSeqNos in one order and make them
visible in the other. We should be able to deal with that, but it will
make some of the commit ordering checks more complicated.

Dan

-- 
Dan R. K. Ports              MIT CSAIL                http://drkp.net/


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: SSI atomic commit
Next
From: Tom Lane
Date:
Subject: Re: Small documentation issue