On Tue, Jul 05, 2011 at 01:15:13PM -0500, Kevin Grittner wrote: > Heikki Linnakangas <heikki.linnakan...@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/ -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers