pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: Heikki Linnakangas <heikki@enterprisedb.com>
Cc: Ludovic Orban <lorban@bitronix.be>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Postgres XA support
Date: Mon, 30 Oct 2006 14:07:00 -0500 (EST)
Message-ID: <Pine.BSO.4.63.0610301345460.2855@leary2.csoft.net> (raw)
In-Reply-To: <452BA80C.7060605@enterprisedb.com>
References: <c016d00b0610071603q63c01a99q8bd165f3cb6a2f04@mail.gmail.com>
	<45288F3C.1030906@ejurka.com>
	<c016d00b0610080656m4eb3bd1aye1c96b3ace6b8812@mail.gmail.com>
	<45297847.7060304@ejurka.com>
	<452A2CA0.2080900@enterprisedb.com>
	<c016d00b0610090451h1bc0e89bscf600eb6ba7747cf@mail.gmail.com>
	<452ABFFE.3000108@enterprisedb.com>
	<c016d00b0610100500x58870319xf2a156065c9e21c4@mail.gmail.com>
	<452BA80C.7060605@enterprisedb.com>



On Tue, 10 Oct 2006, Heikki Linnakangas wrote:

> Ludovic Orban wrote:
>
>> This is a common way of using a XA connection pool that mixes both
>> local and global transactions:
>> 
>> c = ds.getConnection()
>> c.executeUpdate("UPDATE 1")
>> c.setAutoCommit(false)
>> c.executeUpdate("UPDATE 2")
>> tm.begin()
>> c.executeUpdate("UPDATE 3")
>> tm.rollback()
>> c.commit()
>> 
>> UPDATE 1 is done in a local transaction while in autocommit mode, it
>> is committed.
>> UPDATE 2 is done in a local transaction manually committed, it is 
>> committed.
>> UPDATE 3 is done in a global transaction which is rolled back, it is
>> rolled back.
>> 
>> Does PostgreSQL supports this ? If not, applications using Hibernate
>> might not work as it runs queries in local transaction mode on its own
>> during startup.
>
> Hmm, we should be supporting that, but it might not work with the current 
> released version given the bug with setAutoCommit reported by Allan Saddi 
> recently. We should add a test case for that...
>

I see how Allan's patch would get UPDATE 1 to commit, but UPDATE 2 and 3 
are the equivalent of an interleaved transaction and I don't see how that 
could possibly work.  I'm not sure what sort of protection we need to add 
to prevent people from doing this or other transaction handling actions on 
the connection.  Right now the Connection object doesn't know if it is 
being used by a XADatasource.

Kris Jurka



view thread (24+ messages)  latest in thread

Message-ID: <Pine.BSO.4.63.0610301345460.2855@leary2.csoft.net>
Permalink:  ../Pine.BSO.4.63.0610301345460.2855@leary2.csoft.net/
Also on:    postgresql.org/message-id/Pine.BSO.4.63.0610301345460.2855@leary2.csoft.net

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: books@ejurka.com, heikki@enterprisedb.com, lorban@bitronix.be
  Subject: Re: Postgres XA support
  In-Reply-To: <Pine.BSO.4.63.0610301345460.2855@leary2.csoft.net>
  References: <c016d00b0610071603q63c01a99q8bd165f3cb6a2f04@mail.gmail.com> <45288F3C.1030906@ejurka.com> <c016d00b0610080656m4eb3bd1aye1c96b3ace6b8812@mail.gmail.com> <45297847.7060304@ejurka.com> <452A2CA0.2080900@enterprisedb.com> <c016d00b0610090451h1bc0e89bscf600eb6ba7747cf@mail.gmail.com> <452ABFFE.3000108@enterprisedb.com> <c016d00b0610100500x58870319xf2a156065c9e21c4@mail.gmail.com> <452BA80C.7060605@enterprisedb.com> <Pine.BSO.4.63.0610301345460.2855@leary2.csoft.net>

* 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