Skip site navigation (1) Skip section navigation (2)

Re: jdbc xa support

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Michael Allman <msa(at)allman(dot)ms>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: jdbc xa support
Date: 2005-07-23 07:09:06
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Michael Allman wrote:

> 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().

This however isn't true -- the cursor should only be reset if
TMSTARTRSCAN is specified, not on every call.

> 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.

See the description of recover() in the JTA spec:

>> The flag parameter indicates where the recover scan should start or end,
>> or start and end. This method may be invoked one or more times during a
>> recovery scan. The resource manager maintains a cursor which marks the
>> current position of the prepared or heuristically completed transaction
>> list. Each invocation of the recover method moves the cursor passed the
>> set of Xids that are returned.
>> TMSTARTRSCAN - indicates that the recovery scan should be started at the beginning of the
>> prepared or heuristically completed transaction list.

So if TMSTARTRSCAN is specified, you move the cursor to the start of the

Then (regardless of if TMSTARTRSCAN was specified) you generate an array
of Xids to return starting from the current cursor position, and move
the cursor forward past those Xids.

In your case, if you return the whole list when TMSTARTRSCAN is
specified, then that implies you should return an empty list when it's
not specified.

> I added the lines
>     if (flag != TMSTARTRSCAN) {
>         return new Xid[0];
>     }
> to the top of the recover() method and posted a new version at

Not quite -- it's a flag not an enumerated value -- the TM can specify
TMENDRSCAN|TMSTARTRSCAN to restart a scan currently in progress.

'if ((flag & TMSTARTRSCAN) == 0)' should work.


In response to


pgsql-jdbc by date

Next:From: Oliver JowettDate: 2005-07-23 07:13:03
Subject: Re: jdbc xa support
Previous:From: Michael AllmanDate: 2005-07-22 23:07:32
Subject: Re: jdbc xa support

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group