Re: Postgres XA support

From: Kris Jurka <books(at)ejurka(dot)com>
To: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Cc: Ludovic Orban <lorban(at)bitronix(dot)be>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Postgres XA support
Date: 2006-10-30 19:07:00
Message-ID: Pine.BSO.4.63.0610301345460.2855@leary2.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message David Goodenough 2006-10-30 19:22:55 Re: confused about transactions and connection pools
Previous Message Jan de Visser 2006-10-30 18:45:24 Re: XA end then join fix for WebLogic