Re: XAResource implementation
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
Home |
Main Index |
Thread Index