From: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>
Cc: pgsql-hackers@postgresql.org
Subject: Re: SSI atomic commit
Date: Tue, 05 Jul 2011 21:01:19 +0300
Message-ID: <4E13516F.50301@enterprisedb.com> (raw)
In-Reply-To: <4E12FDA8020000250003EFC1@gw.wicourts.gov>
References: <4E12FDA8020000250003EFC1@gw.wicourts.gov>
On 05.07.2011 20:03, Kevin Grittner wrote:
> In reviewing the 2PC changes mentioned in a separate post, both Dan
> and I realized that these were dependent on the assumption that
> SSI's commitSeqNo is assigned in the order in which the transactions
> became visible. There is a race condition such that this is not
> necessarily true. It is a very narrow race condition, which would
> come up very rarely in practice, but Murphy's Law being what it is,
> I think we need to consider it a bug and fix it.
>
> We considered a fix which would be contained within predicate.c code
> and operate by making pessimistic assumptions, so that no false
> negatives occurred. The reason we didn't go that way is that the
> code would be very convoluted and fragile. The attached patch just
> makes it atomic in a very direct way, and adjusts the predicate.c
> code to use the right tests in the right places. We were careful
> not to add any LW locking to the path that a normal transaction
> without an XID is terminating, since there had obviously been
> significant work put into keeping locks out of that code path.
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.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: heikki.linnakangas@enterprisedb.com, Kevin.Grittner@wicourts.gov
Subject: Re: SSI atomic commit
In-Reply-To: <4E13516F.50301@enterprisedb.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox