Re: 2PC transaction id - Mailing list pgsql-hackers

From Oliver Jowett
Subject Re: 2PC transaction id
Date
Msg-id 42C5DDA0.4010708@opencloud.com
Whole thread Raw
In response to Re: 2PC transaction id  (Heikki Linnakangas <hlinnaka@iki.fi>)
Responses Re: 2PC transaction id  (Heikki Linnakangas <hlinnaka@iki.fi>)
List pgsql-hackers
Heikki Linnakangas wrote:
> On Fri, 1 Jul 2005, Oliver Jowett wrote:
>>
>> That implies it's valid (in fact, normal!) to enlist many different RMs
>> in the same transaction branch. Am I interpreting that correctly?
> 
> 
> I see. No, I don't think that's the correct interpretation, though now
> that you point it out, that paragraph is a bit confusing.
> 
> What it means, is that the TM always calls xa_start(), xa_end() and
> xa_prepare() for a RM, even if the transaction doesn't actually have any
> work to do for the RM. It has to be like that in the XA world, because
> the TM doesn't know which RMs the application really uses in the
> transaction.

Sorry to keep beating on this, but I still don't see where the spec says
that you must have only one RM per transaction branch.

2.2.6 says:

> 2.2.6 Transaction Branches
> A global transaction has one or more transaction branches (or branches). A branch is a
> part of the work in support of a global transaction for which the TM and the RM
> engage in a separate but coordinated transaction commitment protocol (see Section 2.3
> on page 8). Each of the RM’s internal units of work in support of a global transaction is
> part of exactly one branch.

> A global transaction might have more than one branch when, for example, the AP uses
> multiple processes or is involved in the same global transaction by multiple remote
> APs.

So it seems to me that branches are intended to allow independent
processes / APs to each have an independent set of "tightly coupled
threads" (as all work on a particular branch is tightly-coupled).
There's no mention of having only one RM per branch, which I'd expect to
see here if it was a requirement.

One implication of the second paragraph is that a single-threaded AP can
use a single transaction branch for all the work it does.

> Disclaimer: I've never used an XA implementation, and I have only little
> experience with JTA.

Mostly the same here. It'd be useful to get input from someone who's
actually written XA code..

-O


pgsql-hackers by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: 2PC transaction id
Next
From: "Marc G. Fournier"
Date:
Subject: Re: Autotools update