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 519FD52BA1 for ; Fri, 22 Jul 2005 03:25:55 -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 88069-04 for ; Fri, 22 Jul 2005 06:25:49 +0000 (GMT) Received: from mail102.csoft.net (lilly.csoft.net [63.111.22.101]) by svr1.postgresql.org (Postfix) with SMTP id 8A13A52849 for ; Fri, 22 Jul 2005 03:25:46 -0300 (ADT) Received: (qmail 61688 invoked by uid 3922); 22 Jul 2005 06:25:47 -0000 Date: Fri, 22 Jul 2005 02:25:47 -0400 (EDT) From: Michael Allman To: Oliver Jowett Cc: pgsql-jdbc@postgresql.org Subject: Re: jdbc xa support In-Reply-To: <42E08A8E.5020807@opencloud.com> Message-ID: <20050722020721.W29135@yvyyl> 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> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200507/242 X-Sequence-Number: 13390 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