Skip site navigation (1) Skip section navigation (2)

Possible oversight in org.postgresql.xa.PGXAConnection.commitPrepared(Xid xid)

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: (view raw, whole thread or download thread mbox)
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?




pgsql-jdbc by date

Next:From: Oliver JowettDate: 2009-12-22 21:07:16
Subject: Re: Urgent. Help needed
Previous:From: Dave CramerDate: 2009-12-22 18:56:29
Subject: Re: Urgent. Help needed

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group