Re: Possible oversight in org.postgresql.xa.PGXAConnection.commitPrepared(Xid xid)
От | Heikki Linnakangas |
---|---|
Тема | Re: Possible oversight in org.postgresql.xa.PGXAConnection.commitPrepared(Xid xid) |
Дата | |
Msg-id | 4B31D66D.8010809@enterprisedb.com обсуждение исходный текст |
Ответ на | Possible oversight in org.postgresql.xa.PGXAConnection.commitPrepared(Xid xid) (Justin Bertram <jbertram@redhat.com>) |
Ответы |
Re: Possible oversight in org.postgresql.xa.PGXAConnection.commitPrepared(Xid
xid)
Re: Possible oversight in org.postgresql.xa.PGXAConnection.commitPrepared(Xid xid) |
Список | pgsql-jdbc |
Justin Bertram wrote: > 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? Yeah, seems like an oversight. Patch attached. We use XAER_RMERR error code in similar places in all the other functions. Does that work for JBoss? -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com Index: org/postgresql/xa/PGXAConnection.java =================================================================== RCS file: /cvsroot/jdbc/pgjdbc/org/postgresql/xa/PGXAConnection.java,v retrieving revision 1.13 diff -u -r1.13 PGXAConnection.java --- org/postgresql/xa/PGXAConnection.java 14 Nov 2007 22:03:36 -0000 1.13 +++ org/postgresql/xa/PGXAConnection.java 23 Dec 2009 08:34:19 -0000 @@ -441,7 +441,7 @@ } catch (SQLException ex) { - throw new XAException(ex.toString()); + throw new PGXAException(GT.tr("Error committing prepared transaction"), ex, XAException.XAER_RMERR); } }
В списке pgsql-jdbc по дате отправления: