You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "David Franke (JIRA)" <ji...@apache.org> on 2009/02/27 17:39:12 UTC

[jira] Created: (JCR-2001) requestObjectCache not cleared in ObjectContentManager.getObjectIterator()

requestObjectCache not cleared in ObjectContentManager.getObjectIterator()
--------------------------------------------------------------------------

                 Key: JCR-2001
                 URL: https://issues.apache.org/jira/browse/JCR-2001
             Project: Jackrabbit Content Repository
          Issue Type: Bug
          Components: jackrabbit-ocm
    Affects Versions: 1.5.2
            Reporter: David Franke
             Fix For: 1.5.2


I found this bug using an old snapshot version (1.5-ASF666297), but I had a look at the sources in the trunk and the implementation has not changed, so I assume it still exists.

This bug only applies to the two methods Iterator getObjectIterator(...). Collection getObjects(...) works.
The method 
public Object getObject(Session session, String path)
puts objects in the RequestObjectCache. If an object is already cached it is retrieved from the cache.

if (requestObjectCache.isCached(path))
 {
        return requestObjectCache.getObject(path);
}

In ObjectContentManager.getObjects() this cache is cleared after retrieving the object.
In ObjectContentManager.getObjectIterator() this is never cleared.

This makes problems if I make several searches with the same ObjectContentManager while the data in the repository changes.

Example:
UserSearch searches for all user with a given name. 
An XPath is created like this:  //(*, xy:user)[@name='givenName']
It always keeps the same instance of ObjectContenManager to call the search until the session expires:

userIterator = ocm.getObjectIterator(query,Query.XPATH);
...

In the meantime a user may change his name. When I now search for this new name, the user is found, but the old user object will be returned (with old name). There is no way to clear the cache manually. ocm.refresh(false) does not help in this case.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Moved: (OCM-4) requestObjectCache not cleared in ObjectContentManager.getObjectIterator()

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OCM-4?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting moved JCR-2001 to OCM-4:
--------------------------------------

          Component/s:     (was: jackrabbit-ocm)
    Affects Version/s:     (was: 1.5.2)
             Workflow: no-reopen-closed, patch-avail  (was: jira)
                  Key: OCM-4  (was: JCR-2001)
              Project: Jackrabbit OCM  (was: Jackrabbit Content Repository)

> requestObjectCache not cleared in ObjectContentManager.getObjectIterator()
> --------------------------------------------------------------------------
>
>                 Key: OCM-4
>                 URL: https://issues.apache.org/jira/browse/OCM-4
>             Project: Jackrabbit OCM
>          Issue Type: Bug
>            Reporter: David Franke
>
> I found this bug using an old snapshot version (1.5-ASF666297), but I had a look at the sources in the trunk and the implementation has not changed, so I assume it still exists.
> This bug only applies to the two methods Iterator getObjectIterator(...). Collection getObjects(...) works.
> The method 
> public Object getObject(Session session, String path)
> puts objects in the RequestObjectCache. If an object is already cached it is retrieved from the cache.
> if (requestObjectCache.isCached(path))
>  {
>         return requestObjectCache.getObject(path);
> }
> In ObjectContentManager.getObjects() this cache is cleared after retrieving the object.
> In ObjectContentManager.getObjectIterator() this is never cleared.
> This makes problems if I make several searches with the same ObjectContentManager while the data in the repository changes.
> Example:
> UserSearch searches for all user with a given name. 
> An XPath is created like this:  //(*, xy:user)[@name='givenName']
> It always keeps the same instance of ObjectContenManager to call the search until the session expires:
> userIterator = ocm.getObjectIterator(query,Query.XPATH);
> ...
> In the meantime a user may change his name. When I now search for this new name, the user is found, but the old user object will be returned (with old name). There is no way to clear the cache manually. ocm.refresh(false) does not help in this case.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (OCM-4) requestObjectCache not cleared in ObjectContentManager.getObjectIterator()

Posted by "Craig Schaefer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OCM-4?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12721817#action_12721817 ] 

Craig Schaefer commented on OCM-4:
----------------------------------

looks to be a side effect of the same problem reported in https://issues.apache.org/jira/browse/OCM-34

> requestObjectCache not cleared in ObjectContentManager.getObjectIterator()
> --------------------------------------------------------------------------
>
>                 Key: OCM-4
>                 URL: https://issues.apache.org/jira/browse/OCM-4
>             Project: Jackrabbit OCM
>          Issue Type: Bug
>            Reporter: David Franke
>
> I found this bug using an old snapshot version (1.5-ASF666297), but I had a look at the sources in the trunk and the implementation has not changed, so I assume it still exists.
> This bug only applies to the two methods Iterator getObjectIterator(...). Collection getObjects(...) works.
> The method 
> public Object getObject(Session session, String path)
> puts objects in the RequestObjectCache. If an object is already cached it is retrieved from the cache.
> if (requestObjectCache.isCached(path))
>  {
>         return requestObjectCache.getObject(path);
> }
> In ObjectContentManager.getObjects() this cache is cleared after retrieving the object.
> In ObjectContentManager.getObjectIterator() this is never cleared.
> This makes problems if I make several searches with the same ObjectContentManager while the data in the repository changes.
> Example:
> UserSearch searches for all user with a given name. 
> An XPath is created like this:  //(*, xy:user)[@name='givenName']
> It always keeps the same instance of ObjectContenManager to call the search until the session expires:
> userIterator = ocm.getObjectIterator(query,Query.XPATH);
> ...
> In the meantime a user may change his name. When I now search for this new name, the user is found, but the old user object will be returned (with old name). There is no way to clear the cache manually. ocm.refresh(false) does not help in this case.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OCM-4) requestObjectCache not cleared in ObjectContentManager.getObjectIterator()

Posted by "Craig Schaefer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OCM-4?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Craig Schaefer updated OCM-4:
-----------------------------

    Status: Patch Available  (was: Open)

Please review. Changes made against 1.5 branch.

> requestObjectCache not cleared in ObjectContentManager.getObjectIterator()
> --------------------------------------------------------------------------
>
>                 Key: OCM-4
>                 URL: https://issues.apache.org/jira/browse/OCM-4
>             Project: Jackrabbit OCM
>          Issue Type: Bug
>            Reporter: David Franke
>         Attachments: OCM-4.patch
>
>
> I found this bug using an old snapshot version (1.5-ASF666297), but I had a look at the sources in the trunk and the implementation has not changed, so I assume it still exists.
> This bug only applies to the two methods Iterator getObjectIterator(...). Collection getObjects(...) works.
> The method 
> public Object getObject(Session session, String path)
> puts objects in the RequestObjectCache. If an object is already cached it is retrieved from the cache.
> if (requestObjectCache.isCached(path))
>  {
>         return requestObjectCache.getObject(path);
> }
> In ObjectContentManager.getObjects() this cache is cleared after retrieving the object.
> In ObjectContentManager.getObjectIterator() this is never cleared.
> This makes problems if I make several searches with the same ObjectContentManager while the data in the repository changes.
> Example:
> UserSearch searches for all user with a given name. 
> An XPath is created like this:  //(*, xy:user)[@name='givenName']
> It always keeps the same instance of ObjectContenManager to call the search until the session expires:
> userIterator = ocm.getObjectIterator(query,Query.XPATH);
> ...
> In the meantime a user may change his name. When I now search for this new name, the user is found, but the old user object will be returned (with old name). There is no way to clear the cache manually. ocm.refresh(false) does not help in this case.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-2001) requestObjectCache not cleared in ObjectContentManager.getObjectIterator()

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-2001?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting updated JCR-2001:
-------------------------------

    Fix Version/s:     (was: 1.5.2)

> requestObjectCache not cleared in ObjectContentManager.getObjectIterator()
> --------------------------------------------------------------------------
>
>                 Key: JCR-2001
>                 URL: https://issues.apache.org/jira/browse/JCR-2001
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-ocm
>    Affects Versions: 1.5.2
>            Reporter: David Franke
>
> I found this bug using an old snapshot version (1.5-ASF666297), but I had a look at the sources in the trunk and the implementation has not changed, so I assume it still exists.
> This bug only applies to the two methods Iterator getObjectIterator(...). Collection getObjects(...) works.
> The method 
> public Object getObject(Session session, String path)
> puts objects in the RequestObjectCache. If an object is already cached it is retrieved from the cache.
> if (requestObjectCache.isCached(path))
>  {
>         return requestObjectCache.getObject(path);
> }
> In ObjectContentManager.getObjects() this cache is cleared after retrieving the object.
> In ObjectContentManager.getObjectIterator() this is never cleared.
> This makes problems if I make several searches with the same ObjectContentManager while the data in the repository changes.
> Example:
> UserSearch searches for all user with a given name. 
> An XPath is created like this:  //(*, xy:user)[@name='givenName']
> It always keeps the same instance of ObjectContenManager to call the search until the session expires:
> userIterator = ocm.getObjectIterator(query,Query.XPATH);
> ...
> In the meantime a user may change his name. When I now search for this new name, the user is found, but the old user object will be returned (with old name). There is no way to clear the cache manually. ocm.refresh(false) does not help in this case.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OCM-4) requestObjectCache not cleared in ObjectContentManager.getObjectIterator()

Posted by "Craig Schaefer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OCM-4?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Craig Schaefer updated OCM-4:
-----------------------------

    Attachment: OCM-4.patch

Two main changes:

1. The getObjectIterator(...):Iterator methods now return an ObjectIterator with their own local object converter and therefore their own ObjectCache instance.  Therefore the global cache belonging to the ObjecContentMangerInstance is not influenced as the iterator is used at some unknown time in the future.

2. refresh() now always clears teh ObjectCache belonging to the instance of ObjectContentManagerImpl as otherwise there is no fallback possible.

Note
1. This patch also contains the related fixes from OCM-34.
2. Possible improvement would be to requestCache.clear() in finally blocks in all occurances, espeically as a get could fail and leave the cache dirty.

> requestObjectCache not cleared in ObjectContentManager.getObjectIterator()
> --------------------------------------------------------------------------
>
>                 Key: OCM-4
>                 URL: https://issues.apache.org/jira/browse/OCM-4
>             Project: Jackrabbit OCM
>          Issue Type: Bug
>            Reporter: David Franke
>         Attachments: OCM-4.patch
>
>
> I found this bug using an old snapshot version (1.5-ASF666297), but I had a look at the sources in the trunk and the implementation has not changed, so I assume it still exists.
> This bug only applies to the two methods Iterator getObjectIterator(...). Collection getObjects(...) works.
> The method 
> public Object getObject(Session session, String path)
> puts objects in the RequestObjectCache. If an object is already cached it is retrieved from the cache.
> if (requestObjectCache.isCached(path))
>  {
>         return requestObjectCache.getObject(path);
> }
> In ObjectContentManager.getObjects() this cache is cleared after retrieving the object.
> In ObjectContentManager.getObjectIterator() this is never cleared.
> This makes problems if I make several searches with the same ObjectContentManager while the data in the repository changes.
> Example:
> UserSearch searches for all user with a given name. 
> An XPath is created like this:  //(*, xy:user)[@name='givenName']
> It always keeps the same instance of ObjectContenManager to call the search until the session expires:
> userIterator = ocm.getObjectIterator(query,Query.XPATH);
> ...
> In the meantime a user may change his name. When I now search for this new name, the user is found, but the old user object will be returned (with old name). There is no way to clear the cache manually. ocm.refresh(false) does not help in this case.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.