X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CF09252B64 for ; Wed, 27 Jul 2005 00:40:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 13279-08 for ; Wed, 27 Jul 2005 03:40:34 +0000 (GMT) Received: from mail102.csoft.net (lilly.csoft.net [63.111.22.101]) by svr1.postgresql.org (Postfix) with SMTP id 3C7AE52B7A for ; Wed, 27 Jul 2005 00:40:33 -0300 (ADT) Received: (qmail 14936 invoked by uid 3922); 27 Jul 2005 03:40:33 -0000 Date: Tue, 26 Jul 2005 23:40:33 -0400 (EDT) From: Michael Allman To: Oliver Jowett Cc: pgsql-jdbc@postgresql.org Subject: Re: jdbc xa patches In-Reply-To: <42E6E2AD.9010104@opencloud.com> Message-ID: <20050726232828.S74424@yvyyl> References: <20050726193540.M74424@yvyyl> <42E6D231.8090002@opencloud.com> <42E6E2AD.9010104@opencloud.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200507/347 X-Sequence-Number: 13495 On Wed, 27 Jul 2005, Oliver Jowett wrote: > Oliver Jowett wrote: > >> Shouldn't the XAResource check the server version on construction or on >> start()/recover() to make sure that it's actually going to be able to >> use PREPARE TRANSACTION later? Or is erroring out with a syntax error at >> the point of prepare() sufficient? (I'd like to see a better error >> message there at least) > > More generally: can we get XAExceptions thrown with useful messages? It > seems like there's no direct constructor that gives you both message and > error code, but the error code is a public field so you can set it after > construction before throwing. Short answer: yes. Long answer: Since the client of a PGXAResource instance is a transaction manager I see no benefit. The transaction manager will make a decision on what to do based on the code carried by XAException and carry on. Maybe it will log a message. > Also, in the case where the failure is caused by another exception, we > should generally chain that exception rather than writing it to the log > writer. See how PSQLException does this for details.. > > There's enough meddling there that it might be worth subclassing > XAException to automate it all.. or have a helper method somewhere. I'm just not sure it's worth the effort. I did put in log messages that I think will help debug problems and whatnot. But exceptions are going to be handled by the TM and will not be rethrown to any user/app code. Maybe we should do more logging? I'm not quite sure that would be much benefit either. I've found the current level of logging to be adequate. On a related note, I think we should do some kind of app server testing before this code is released. I think this calls for Cactus. What do you think? I know how to use JBoss. Maybe someone else could write build files to deploy to other app servers. Michael