Re: XAResource implementation

From: Kris Jurka <books(at)ejurka(dot)com>
To: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Cc: joël Winteregg <joel(dot)winteregg(at)gmail(dot)com>, pgsql-jdbc(at)postgresql(dot)org, Ludovic Orban <ludovic(dot)orban(at)gmail(dot)com>
Subject: Re: XAResource implementation
Date: 2007-11-13 18:06:22
Message-ID: Pine.BSO.4.64.0711131301130.21066@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Tue, 13 Nov 2007, Heikki Linnakangas wrote:

> It looks like there is indeed a bug in the Postgres driver. I believe it was
> introduced by the recent changes to keep the connection in autocommit mode
> when no XA-transaction is in progress.
>
> It's this call sequence that borks it up:
>
> xares.start()
> conn = xares.getConnection()
> // do stuff
> conn.close();
> conn = xares.getConnection()
> // do more stuff
> xares.end()
> xares.commit()
>
> The 2nd getConnection call inadvertently commits the transaction, and opens
> another one.

When I raised this issue, you said it can't/shouldn't happen. What's
different now? It's still a bug in the driver, but is the calling code
doing something it shouldn't?

http://archives.postgresql.org/pgsql-jdbc/2007-06/msg00095.php

> Patch attached. I also added a test for this in the test suite.
>

transaction_timestamp() is an 8.2 feature, but since XA is an 8.1 feature
you should use now() instead. (No need for a new patch, I've updated mine
here.)

Kris Jurka

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message joël Winteregg 2007-11-13 20:23:31 Re: XAResource implementation
Previous Message Heikki Linnakangas 2007-11-13 16:51:07 Re: XAResource implementation