Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 43A046335BE for ; Tue, 22 Dec 2009 16:22:28 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 47502-02 for ; Tue, 22 Dec 2009 20:22:08 +0000 (UTC) X-Greylist: delayed 00:45:52.961818 by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mail.postgresql.org (Postfix) with ESMTP id D9B8B634902 for ; Tue, 22 Dec 2009 16:20:13 -0400 (AST) Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBMJYJS9012536 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 22 Dec 2009 14:34:19 -0500 Received: from mail06.corp.redhat.com (zmail06.collab.prod.int.phx2.redhat.com [10.5.5.45]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBMJYJX6006348 for ; Tue, 22 Dec 2009 14:34:19 -0500 Date: Tue, 22 Dec 2009 14:34:19 -0500 (EST) From: Justin Bertram To: pgsql-jdbc@postgresql.org Message-ID: <553112194.2096301261510459113.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com> In-Reply-To: <1542801081.2095931261510256414.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com> Subject: Possible oversight in org.postgresql.xa.PGXAConnection.commitPrepared(Xid xid) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.5.5.41] X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200912/91 X-Sequence-Number: 20172 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