From: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> |
---|---|
To: | Justin Bertram <jbertram(at)redhat(dot)com> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Possible oversight in org.postgresql.xa.PGXAConnection.commitPrepared(Xid xid) |
Date: | 2009-12-23 08:35:57 |
Message-ID: | 4B31D66D.8010809@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Justin Bertram wrote:
> 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?
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
Attachment | Content-Type | Size |
---|---|---|
jdbc-commitprepared-xa-error-code-1.patch | text/x-diff | 647 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Kris Jurka | 2009-12-23 20:58:29 | Re: Possible oversight in org.postgresql.xa.PGXAConnection.commitPrepared(Xid xid) |
Previous Message | Oliver Jowett | 2009-12-22 21:07:16 | Re: Urgent. Help needed |