Re: XAResource implementation
От | Heikki Linnakangas |
---|---|
Тема | Re: XAResource implementation |
Дата | |
Msg-id | 473A2AB3.2040701@enterprisedb.com обсуждение исходный текст |
Ответ на | Re: XAResource implementation (Kris Jurka <books@ejurka.com>) |
Ответы |
Re: XAResource implementation
|
Список | pgsql-jdbc |
Kris Jurka wrote: > > > 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 Oh, I had forgotten about that. The difference is the close() between the getConnection()s. I started having second doubts about that case you posted in June, so I tested what Derby does if you call getConnection() twice, without a close in between. You get an error ("Cannot close a connection while a global transaction is still active."), so at least they consider it incorrect as well. Throwing an error in that case would be a nice thing for us to do as well. Currently, we just silently rollback. >> 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.) Thanks! -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
В списке pgsql-jdbc по дате отправления: