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 16:33:18 +1200
Message-ID: <42E70E8E.9010408@opencloud.com> (raw)
In-Reply-To: <20050726225605.T74424@yvyyl>
References: <20050726193540.M74424@yvyyl>
<42E6D231.8090002@opencloud.com>
<20050726225605.T74424@yvyyl>
Michael Allman wrote:
> On Wed, 27 Jul 2005, Oliver Jowett wrote:
>
>> We now use 4-space indents, not tabs.
>
> I'm away from my normal dev machine and am flailing away with unfamiliar
> tools. Do you have a utility that will indent as desired?
perl? :-)
>> 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)
>
> If we call statement.executeUpdate("SOME QUERY POSTGRESQL DOESN'T
> UNDERSTAND") will it throw an instance of SQLException?
Yes, per JDBC spec. Still, it is generally tricky to distinguish a
particular error class from more general errors (SQLSTATE only gets you
so far).
>> Having ResourceAssociationState as a full-blown class seems like
>> overkill since you only have one instance anyway.
>
> Maybe. Java 1.4 doesn't have enums. What do you suggest as an
> alternative?
Just a bare int?
>> Is XID_TO_TRANSACTION_STATE_MAP actually necessary? It seems like it's
>> only there for detecting XA protocol errors (which would otherwise show
>> up as errors from the backend, e.g. trying to commit a nonexistant
>> transaction), and for tracking the state of the transaction that is
>> currently suspended or currently associated (of which there can only be
>> one in the current implementation)
>
> In the implementation of rollback() it is used to determine whether to
> call physicalConnection.rollback() or issue a "ROLLBACK PREPARED" query.
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'm not sure it's necessary for recover() to avoid returning
>> non-JDBC-originated transactions; from memory the TM is already required
>> to handle recovered Xids that were not generated by it. (need to check
>> the XA spec here)
>
> Quite the opposite. The TM is required to ignore xids that were not
> generated by it.
Sorry, that's what I meant by "handle" as in "not complain about" aka
"ignore" :)
> Besides, if someone prepares a transaction with id "whatever", we aren't
> going to be able to decode that to an xid.
I guess that's a good reason.
-O
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: <42E70E8E.9010408@opencloud.com>
References: <20050726193540.M74424@yvyyl> <42E6D231.8090002@opencloud.com> <20050726225605.T74424@yvyyl> <42E70E8E.9010408@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