pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Michael Allman <msa@allman.ms>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: jdbc xa patches
Date: Wed, 27 Jul 2005 17:27:57 +1200
Message-ID: <42E71B5D.5000609@opencloud.com> (raw)
In-Reply-To: <20050727005909.W74424@yvyyl>
References: <20050726193540.M74424@yvyyl>
	<42E6D231.8090002@opencloud.com>
	<20050726225605.T74424@yvyyl>
	<42E70E8E.9010408@opencloud.com>
	<20050727005909.W74424@yvyyl>

Michael Allman wrote:

> First, I'm assuming that any general release of the JDBC driver with XA 
> support will make it clear up front that it requires Postgres 8.1.

Sure, but not everyone reads documentation before posting "problems" to 
the list.

> With that in mind, if some mortal is foolish enough to attempt to 
> prepare a transaction on an unsupported backend, executeUpdate() will 
> barf up an SQLException, which will cause PGXAResource to throw an 
> XAException yada yada yada which will cause the TM to rollback the 
> transaction.  So at least they won't be in Dangling Transaction Hell.

Well, that's a given; I'd be complaining much more loudly if it silently 
ate errors!

> Anyway, I'm counting on Postgres users knowing what they're doing, esp. 
> with something as non-trivial as XA support.

You can't really assume that users of XA are familiar with the details 
of our particular XA implemenation, like "a syntax error at this point 
means your backend is too old".

Back to my original point: It Needs A Better Error Message. How you do 
this I don't really care, checking the server version just seemed like 
the most reliable way to distinguish "it doesn't support 2PC" from "some 
random connection error".

>> Isn't that covered by tracking the state of the one transaction that's 
>> currently in progress on the connection? i.e. if you get asked to 
>> rollback() while it's active, you do a rollback(); otherwise you do a 
>> ROLLBACK PREPARED.
> 
> I think you're right.  I also think this is a matter of style/personal 
> preference.  I like to give classes some of the responsibility for their 
> correct usage.  It makes it easier to diagnose problems when a class 
> instance is used incorrectly.

My point was you can still do 90% of this without the extra complexity, 
and the other 10% will get handled by the server (if, for example, a 
broken TM asks to commit a transaction that was never prepared)

Complexity is bad for maintenance. I'm probably going to end up at least 
helping with maintenance of this code, which is why I'm complaining up 
front.

-O



view thread (18+ messages)  latest in thread

Message-ID: <42E71B5D.5000609@opencloud.com>
Permalink:  ../42E71B5D.5000609@opencloud.com/
Also on:    postgresql.org/message-id/42E71B5D.5000609@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, msa@allman.ms
  Subject: Re: jdbc xa patches
  In-Reply-To: <42E71B5D.5000609@opencloud.com>
  References: <20050726193540.M74424@yvyyl> <42E6D231.8090002@opencloud.com> <20050726225605.T74424@yvyyl> <42E70E8E.9010408@opencloud.com> <20050727005909.W74424@yvyyl> <42E71B5D.5000609@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox