On Fri, 1 Jul 2005, Oliver Jowett wrote:

Ok, so how do we get XA working when a single global transaction
involves two databases on the same cluster?

The scenario is:

- there are two independent resource managers participating in a single
global transaction
- each resource manager has a connection to the database it is managing,
and a SQL-level transaction running against that database
- the global TM tells both resource managers to prepare their part of
the global transaction, passing the same XID to both

If the TM does that, it's broken.

The XID consists of three parts:

format id: a constant. Not interesting.

gtrid: Global Transaction Identifier. This identifies the global transaction in the TM. All XIDs that have the same gtrid should be completed atomically by the TM

branch id: Branch Identifier. Every RM involved in the global transaction is given a *different* branch id.

In the above case, the TM would give the two resource managers XIDs that have the same gtrid but different branch ids.

From the RM point of view, those fields have no significance and the XID
as whole is used to identify the transaction.

So the RM should never see the same XID twice, except when the TM specifically uses the TMJOIN or the TMSUSPEND/TMRESUME flags. If the TM uses those flags, it'll only issue one prepare.

- Heikki

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
   (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to