Re: jdbc xa support - Mailing list pgsql-jdbc

From Michael Allman
Subject Re: jdbc xa support
Date
Msg-id 20050722020721.W29135@yvyyl
Whole thread Raw
In response to Re: jdbc xa support  (Oliver Jowett <oliver@opencloud.com>)
Responses Re: jdbc xa support
List pgsql-jdbc
On Fri, 22 Jul 2005, Oliver Jowett wrote:

>> I do track the recovery scan state.  Each call puts the scan cursor at the
>> end of the list.
>
> Uh, are we looking at the same code here? I don't see anything in the code
> from pgjdbcxa-20050721.jar that records whether we are at the end of the list
> or not between calls to recover(), and I don't see anything that looks for
> TMSTARTRSCAN to reset that state. If I've missed it, can you point it out to
> me?

You're right.  But so am I.  Since the code returns the complete list, the
"cursor" is always at the "end" of the "list" of prepared xids.  The code
simply starts at the beginning for each call to recover().

>> I still don't see a violation of the API.
>
> The API says that if a TM does this:
>
>  Xid[] xids_1 = resource.recover(TMSTARTRSCAN);
>  Xid[] xids_2 = resource.recover(TMNOFLAGS);
>  Xid[] xids_3 = resource.recover(TMNOFLAGS);
>
> then xids_1, xids_2, and xids_3 reflect consecutive (and possibly empty if
> you hit the end) parts of the recovery list. It seems your code does not
> respect this -- it will return the full list of Xids repeatedly in each of
> xids_1, xids_2 and xids_3.

I don't see anything in the JTA spec that says the TMNOFLAGS int means
anything other than that no other flag was passed to recover().  In the
DTP spec it says something about returning xids starting at the current
cursor position.

>> It looks like the JTA API is wrong or there's a typo.  If we follow the
>> spirit of the DTP spec it seems that the TMNOFLAGS flag means "return some
>> xids starting from where we last left off".  I'm still not sure what
>> TMENDRSCAN means.
>
> The JTA specification is fairly clear about their meanings. TMNOFLAGS does
> indeed mean "continue the current scan". TMENDRSCAN means "I'm done with this
> scan", and allows RMs to free resources they have allocated for the scan.

I added the lines

     if (flag != TMSTARTRSCAN) {
         return new Xid[0];
     }

to the top of the recover() method and posted a new version at

http://www.allman.ms/pgjdbcxa/pgjdbcxa-20050722.jar

How does that look?

Michael

pgsql-jdbc by date:

Previous
From: Oliver Jowett
Date:
Subject: Re: jdbc xa support
Next
From: Michael Allman
Date:
Subject: prepareStatement()