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

From Heikki Linnakangas
Subject Re: 2PC transaction id
Date
Msg-id Pine.OSF.4.61.0507011939350.496896@kosh.hut.fi
Whole thread Raw
In response to Re: 2PC transaction id  (Oliver Jowett <oliver@opencloud.com>)
Responses Re: 2PC transaction id
List pgsql-hackers
On Fri, 1 Jul 2005, Oliver Jowett wrote:

> What I'm confused about is, for example, 3.3.1 in the DTP:XA spec:
>
>> 3.3.1 Registration of Resource Managers
>> Normally, a TM involves all associated RMs in a transaction branch. (The TMs set of
>> RM switches, described in Section 4.3 on page 21 tells the TM which RMs are
>> associated with it.) The TM calls all these RMs with xa_start(), xa_end(), and
>> xa_prepare (), although an RM that is not active in a branch need not participate further
>> (see Section 2.3.2 on page 8). A technique to reduce overhead for infrequently-used
>> RMs is discussed below.
>
> 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.

Chapter 3.3.1 talks about dynamic registration. In that scheme, the RM 
registers itself to the TM when the application calls the RM for the first 
time in the transaction. That's an optimization to avoid the overhead of 
the start/end/prepare cycle for RMs that aren't really involved.

JTA works differently from XA on this matter. In JTA, the application 
server tells the TM which RMs are involved in the transaction, so the 
XA dynamic registration has not been included in JTA.

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

- Heikki


pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: [PATCHES] Users/Groups -> Roles
Next
From: Heikki Linnakangas
Date:
Subject: Re: 2PC transaction id