Re: jdbc xa support

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: jdbc xa support
Дата
Msg-id 42E1ED12.6060105@opencloud.com
обсуждение исходный текст
Ответ на Re: jdbc xa support  (Michael Allman <msa@allman.ms>)
Ответы Re: jdbc xa support  (Michael Allman <msa@allman.ms>)
Re: jdbc xa support  (Michael Allman <msa@allman.ms>)
Список 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.

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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Michael Allman
Дата:
Сообщение: Re: jdbc xa support
Следующее
От: Oliver Jowett
Дата:
Сообщение: Re: jdbc xa support