Return-Path: Delivered-To: apmail-db-jdo-dev-archive@www.apache.org Received: (qmail 25331 invoked from network); 6 Feb 2006 00:14:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 6 Feb 2006 00:14:19 -0000 Received: (qmail 27624 invoked by uid 500); 6 Feb 2006 00:14:19 -0000 Mailing-List: contact jdo-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jdo-dev@db.apache.org Delivered-To: mailing list jdo-dev@db.apache.org Received: (qmail 27606 invoked by uid 99); 6 Feb 2006 00:14:19 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Feb 2006 16:14:18 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE,SPF_HELO_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [80.67.18.16] (HELO smtprelay04.ispgateway.de) (80.67.18.16) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Feb 2006 16:14:18 -0800 Received: (qmail 26403 invoked from network); 6 Feb 2006 00:13:55 -0000 Received: from unknown (HELO [192.168.178.20]) (383542@[84.190.50.36]) (envelope-sender ) by smtprelay04.ispgateway.de (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 6 Feb 2006 00:13:55 -0000 Message-ID: <43E69493.5060404@artnology.com> Date: Mon, 06 Feb 2006 01:13:07 +0100 From: Joerg von Frantzius User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Apache JDO project Subject: Re: Cache invalidation References: <43E32981.7010807@artnology.com> <43E64533.5060904@tralfamadore.com> In-Reply-To: <43E64533.5060904@tralfamadore.com> Content-Type: multipart/alternative; boundary="------------070500050907010103050303" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --------------070500050907010103050303 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Hi Wes, thanks for your answer, please see my comments below. Wesley Biggs schrieb: > Joerg von Frantzius wrote: >> The problem here is that either evict() accepts only PC objects, not >> object ids, so we have to call PM.getObjectById() beforehand. If no >> object for that id was present, we're instantiating a hollow object >> here only to discard it afterwards, that's not very effective. > I'm not quite parsing your "either" here, sorry. But > DataStoreCache.evict() accepts object IDs. I'm not sure I see the > necessity of calling PM.evict() as well, unless you have some > particularly long-lived transactions. We're doing nontransactional reads on long-living objects, so I guessed we needed to call PM.evict() to avoid accessing stale field data. You're of course right about DatastoreCache.evict() accepting IDs, thanks for pointing that out. I had just seen the same method signature, and so I assumed the parameter semantics also being the same. Calling it evictById() probably would be less misleading, even more so as a mistake here won't show up immediately. Also, if you only have a jar without sourcecode, the signatures are absolutely indistinguishable (Which of course is not an excuse for not having read the spec thoroughly enough ;) >> As we really want cache invalidation here, not eviction, this is even >> worse. For this purpose, it would be far more convenient to have some >> method like invalidateCachesFor(Object id) on PersistenceManagerFactory. > That's the intention of DataStoreCache.evict(). The semantics are > different than PM.evict(). Only now I start understanding that I was misled by the word evict() for the L2-cache: as the user never gets hold of an L2 cache object anyway (a L1-cache object will be created for that), he shouldn't need to care whether the L2 cache internally needs to throw away (evict) some object in order to invalidate cached state. Spec says "/The evict methods are hints to the implementation that the instances referred to by the object ids are stale and should be evicted from the cache./" It might be nit-picking, but I think it would be clearer if the method was called invalidateBy�d(), which would be natural for some cache interface, and if the explanation said "/that the object state referred to by the object ids should be discarded/" Also, the spec doesn't say anything about DatastoreCache.evict() having any impact on P-nontrans instances. So I still need to go to every PM and evict there as well, which is very inconvenient. Or does the "evict" row in table 2 for P-nontrans really apply to /both /evict() methods, not only PM.evict()!? The RI JPOX isn't doing anything like that, by the way. >> To make our wish complete ;) this method would transition all >> non-transactional instances to hollow for that id, for all the PMs >> the PMF has given out. All transactional objects with that id should >> be transitioned to hollow after their transaction has completed >> (either with commit or rollback). > Persistent nontransactional instances will have to be revalidated > against the datastore (or cache thereof) before being re-enlisted in a > transaction anyway. The behavior you mention is a good way to > implement that, but it doesn't need to be mandated (hollow is not a > user-visible state). I'm not sure what you mean by mandating here? I'd just like to make sure that invalidated non-transactional instances will reload state upon next read access, without having to iterate all PMs. Also, I'd rather not like a call to PM.getObjectById() afterwards returning a new Java object for the same id, which I guess is the case after calling PM.evict(PM.getObjectById(id)). If a method invalidateById() existed, I'd see the sense of evict() in releasing the associated memory. evict() currently does two things at same time: evicting and transitioning to hollow. For (distributed) cache invalidation, I find it sensible to desire only the latter. Regards, J�rg --------------070500050907010103050303--