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(Xidxid) [1] when working with some transaction recovery scenarios after
adatabase 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
errorcodes [3] to identify exactly the nature of the error. Unfortunately Java allows an XAException to be constructed
usinga default constructor and a String constructor. Using these constructors results in an errorCode value of 0 for
theXAException which is not valid.
In the latest PostgreSQL JDBC3 driver (8.4-701) this is what org.postgresql.xa.PGXAConnection.commitPrepared(Xid xid)
doesso 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
resetof 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