From: Oliver Jowett <oliver@opencloud.com>
To: Michael Allman <msa@allman.ms>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: jdbc xa support
Date: Sat, 23 Jul 2005 19:09:06 +1200
Message-ID: <42E1ED12.6060105@opencloud.com> (raw)
In-Reply-To: <20050722020721.W29135@yvyyl>
References: <20050719193245.D20902@yvyyl>
<E3F1D1B7-B41C-40C4-9621-60F96363A032@fastcrypt.com>
<Pine.OSF.4.61.0507201916300.205200@kosh.hut.fi>
<20050720211921.V54984@yvyyl>
<Pine.OSF.4.61.0507212140250.34894@kosh.hut.fi>
<20050721203342.W75792@yvyyl>
<42E053B0.8080807@opencloud.com>
<20050721220519.U75792@yvyyl>
<42E05E6E.4070001@opencloud.com>
<20050722003221.X7757@yvyyl>
<42E07DDA.7080103@opencloud.com>
<20050722010716.D7757@yvyyl>
<42E08A8E.5020807@opencloud.com>
<20050722020721.W29135@yvyyl>
Michael Allman wrote:
> Since the code returns the complete list,
> the "cursor" is always at the "end" of the "list" of prepared xids.
Correct.
> 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
list.
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
>
> http://www.allman.ms/pgjdbcxa/pgjdbcxa-20050722.jar
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.
-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 support
In-Reply-To: <42E1ED12.6060105@opencloud.com>
References: <20050719193245.D20902@yvyyl> <E3F1D1B7-B41C-40C4-9621-60F96363A032@fastcrypt.com> <Pine.OSF.4.61.0507201916300.205200@kosh.hut.fi> <20050720211921.V54984@yvyyl> <Pine.OSF.4.61.0507212140250.34894@kosh.hut.fi> <20050721203342.W75792@yvyyl> <42E053B0.8080807@opencloud.com> <20050721220519.U75792@yvyyl> <42E05E6E.4070001@opencloud.com> <20050722003221.X7757@yvyyl> <42E07DDA.7080103@opencloud.com> <20050722010716.D7757@yvyyl> <42E08A8E.5020807@opencloud.com> <20050722020721.W29135@yvyyl> <42E1ED12.6060105@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