X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 22DB052A3A for ; Sat, 23 Jul 2005 04:09:13 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 30863-05 for ; Sat, 23 Jul 2005 07:09:10 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 4559352A35 for ; Sat, 23 Jul 2005 04:09:09 -0300 (ADT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1DwE8B-0007lj-G3; Sat, 23 Jul 2005 19:09:07 +1200 Message-ID: <42E1ED12.6060105@opencloud.com> Date: Sat, 23 Jul 2005 19:09:06 +1200 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050324) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Michael Allman Cc: pgsql-jdbc@postgresql.org Subject: Re: jdbc xa support References: <20050719193245.D20902@yvyyl> <20050720211921.V54984@yvyyl> <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> In-Reply-To: <20050722020721.W29135@yvyyl> X-Enigmail-Version: 0.90.2.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200507/263 X-Sequence-Number: 13411 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