openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <curti...@gmail.com>
Subject Re: [jira] Commented: (OPENJPA-1511) Executing a cached query doesn't properly cache results after DataCache eviction
Date Wed, 03 Mar 2010 16:42:08 GMT
The more I think about this, the more unsure I am of what the correct answer
is. Perhaps someone else on the dev list has some input?

Is the test that I've posted to OPENJPA-1511 a valid test?

-- 
Thanks,
Rick

On Wed, Mar 3, 2010 at 10:32 AM, Ravi Palacherla <ravi.palacherla@oracle.com
> wrote:

> Hi Rick,
>
> I have a question about the following comment:
>  >> * Execute a cached query which will return [E1]. This *should* result
> in [E1] being placed back in the L2 cache, but it isn't.
>
> When [E1] is in L1cache then what is the need to check L2 cache ?
>
> It is only when [E1] is missing in L1cache is when it tries to fetch from
> L2cache.
> At this time as L2cache does not contain [E1] it goes to DB and re-populate
> L2cache with [E1].
>
> Regards,
> Ravi.
>
> -----Original Message-----
> From: Rick Curtis (JIRA) [mailto:jira@apache.org]
> Sent: Wednesday, March 03, 2010 8:32 AM
> To: dev@openjpa.apache.org
> Subject: [jira] Commented: (OPENJPA-1511) Executing a cached query doesn't
> properly cache results after DataCache eviction
>
>
>    [
> https://issues.apache.org/jira/browse/OPENJPA-1511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12840696#action_12840696]
>
> Rick Curtis commented on OPENJPA-1511:
> --------------------------------------
>
> I don't think that calling Cache.evict() should also remove an Entity from
> the L1 cache. The javadoc for javax.persistence.Cache.evict(..) doesn't
> mention anything about removing the provided Entity from the persistence
> context.
>
> I think the problem here is as follows:
> * Entity [E1] is in the L2 cache and is managed by the current persistence
> context (L1 cache).
> * Evict [E1] from the L2 cache. [E1] is still in the L1 cache.
> * Execute a cached query which will return [E1]. This *should* result in
> [E1] being placed back in the L2 cache, but it isn't.
>
> Make sense?
>
> > Executing a cached query doesn't properly cache results after DataCache
> eviction
> >
> --------------------------------------------------------------------------------
> >
> >                 Key: OPENJPA-1511
> >                 URL: https://issues.apache.org/jira/browse/OPENJPA-1511
> >             Project: OpenJPA
> >          Issue Type: Bug
> >    Affects Versions: 2.0.0-beta
> >            Reporter: Rick Curtis
> >            Assignee: Ravi P Palacherla
> >         Attachments: TestCache.java
> >
> >
> > When doing some testing I found that the QueryCache sometimes doesn't put
> results into the DataCache.
> > I haven't had time to debug the problem, but I'm opening this JIRA so I
> can attach the test case I've created.
> > The test scenario is as follows:
> > String query = "Select t FROM Item t where 1=1 ORDER BY t.id";
> > items = em.createQuery(query,Item.class).getResultList();
> > assertTrue(storeCache.contains(Item.class, items.get(0).getId()));
> > // Make sure that all of the results are in the DataCache.
> > for(Item o : items){
> >   assertTrue(storeCache.contains(Item.class, o.getId()));
> > }
> > storeCache.evict(Item.class,items.get(0).getId());
> > // Evict one result
> > assertFalse(storeCache.contains(Item.class,items.get(0).getId()));
> >
> > // Executing the same query should re-populate the datacache
> > items = em.createQuery(query,Item.class).getResultList();
> > assertTrue(storeCache.contains(Item.class, items.get(0).getId())); //
> fails here
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message