Unix Technical Forum

Re: 2PC transaction id

This is a discussion on Re: 2PC transaction id within the pgsql Hackers forums, part of the PostgreSQL category; --> >>> branch id: Branch Identifier. Every RM involved in the global >>> transaction is given a *different* branch id. ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 04:42 AM
Barry Lind
 
Posts: n/a
Default Re: 2PC transaction id

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

>>
>> Hm, I am confused then -- the XA spec definitely talks about

enlisting
>> multiple RMs in a single transaction branch.
>>
>> Can you explain?

>
>I oversimplified a bit. The TM *can* enlist multiple threads of control

(=
>connection in JTA) to the same transaction branch. That's called
>"tightly-coupled threads", and they should then be treated as one
>local transaction in the RM. The calls will look like this:
>
>conn1.start(xid1, TMNOFLAGS);
>...
>conn2.start(xid1, TMJOIN);
>...
>conn1.end(xid1, TMSUCCESS);
>...
>conn2.end(xid1, TMSUCCESS);
>
>connX.prepare(xid1);
>connX.commit(xid1, false);
>
>conn1 and conn2 must share locks and see each others changes. They
>mustn't deadlock each other. The JDBC driver can implement this in a

very
>straight-forward way by using the same physical connection for both

conn1
>and conn2. Note that there's only one prepare, and it can be issued

using
>any connection.


In your example above couldn't conn1 and conn2 be running in two
different JVMs? And thus your statement that 'the JDBC driver can
implement this in a very straight-forward way by using the same physical
connection' would not be true. I can't see a way for two JVMs (possibly
on different client machines even) to share the same physical
connection.

--Barry




---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-11-2008, 04:42 AM
Heikki Linnakangas
 
Posts: n/a
Default Re: 2PC transaction id

On Fri, 1 Jul 2005, Barry Lind wrote:

>> I oversimplified a bit. The TM *can* enlist multiple threads of control
>> (= connection in JTA) to the same transaction branch. That's called
>> "tightly-coupled threads", and they should then be treated as one
>> local transaction in the RM. The calls will look like this:
>>
>> conn1.start(xid1, TMNOFLAGS);
>> ...
>> conn2.start(xid1, TMJOIN);
>> ...
>> conn1.end(xid1, TMSUCCESS);
>> ...
>> conn2.end(xid1, TMSUCCESS);
>>
>> connX.prepare(xid1);
>> connX.commit(xid1, false);
>>
>> conn1 and conn2 must share locks and see each others changes. They
>> mustn't deadlock each other. The JDBC driver can implement this in a

> very
>> straight-forward way by using the same physical connection for both

> conn1
>> and conn2. Note that there's only one prepare, and it can be issued

> using
>> any connection.

>
> In your example above couldn't conn1 and conn2 be running in two
> different JVMs? And thus your statement that 'the JDBC driver can
> implement this in a very straight-forward way by using the same physical
> connection' would not be true. I can't see a way for two JVMs (possibly
> on different client machines even) to share the same physical
> connection.


I can't immediately think of a reason why they couldn't run in two
different JVMs, but I also can't think of a reason why anyone would want
to do that. Can you give a use case for that?

Also, it would require an application server that would support that, and
I don't think there is any.

- Heikki

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:06 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com