From: | Justin Bertram <jbertram(at)redhat(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Possible oversight in org.postgresql.xa.PGXAConnection.commitPrepared(Xid xid) |
Date: | 2009-12-22 19:34:19 |
Message-ID: | 553112194.2096301261510459113.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
I searched the mailing list, but I couldn't find anything addressing this issue.
I work with JBoss Transactions (JBossTS) and I noticed something recently in org.postgresql.xa.PGXAConnection.commitPrepared(Xid xid) [1] when working with some transaction recovery scenarios after a database failure. commitPrepared calls:
throw new XAException(ex.toString());
The Java XA interface assumes that a thrown javax.transaction.xa.XAException [2] will contain one of the standard XA error codes [3] to identify exactly the nature of the error. Unfortunately Java allows an XAException to be constructed using a default constructor and a String constructor. Using these constructors results in an errorCode value of 0 for the XAException which is not valid.
In the latest PostgreSQL JDBC3 driver (8.4-701) this is what org.postgresql.xa.PGXAConnection.commitPrepared(Xid xid) does so the exception cannot be handled cleanly. JBossTS does not know what this error signifies so it has to assume the worst (i.e. that the resource is in an indeterminate state and it should not attempt to recover the transaction). Any reset of the database state will require manual intervention.
Can this be changed to throw an XAException with the appropriate XAER error code?
Justin
[1] http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/jdbc/pgjdbc/org/postgresql/xa/PGXAConnection.java?rev=1.13&content-type=text/x-cvsweb-markup&only_with_tag=REL8_4_701
[2] http://java.sun.com/javaee/5/docs/api/javax/transaction/xa/XAException.html
[3] http://java.sun.com/javaee/5/docs/api/constant-values.html#javax.transaction.xa.XAException.XA_HEURCOM
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Jowett | 2009-12-22 21:07:16 | Re: Urgent. Help needed |
Previous Message | Dave Cramer | 2009-12-22 18:56:29 | Re: Urgent. Help needed |