Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Cache replication problem with UpdateAllQuery
Cache replication problem with UpdateAllQuery [message #628865] Fri, 24 September 2010 14:09 Go to next message
Amod M is currently offline Amod MFriend
Messages: 11
Registered: July 2009
Junior Member
I have single database & clusterd DatabaseSession

I am using UpdateAllQuery to do bulk update. As a result of executing UpdateAllQuer, EclipseLink shared cache contains stale copy. When we read object again in local session (where UpdateAllQuery was executed ), we get updated objects.

UpdateAllQuery updateAllQuery = new UpdateAllQuery(someObject);
ExpressionBuilder builder = updateAllQuery.getExpressionBuilder();
updateAllQuery.setSelectionCriteria(expression);
updateAllQuery.addUpdate(..);
updateAllQuery.setCacheUsage(UpdateAllQuery.INVALIDATE_CACHE );
localSession.commitTransaction();

localSession.readObject(someObject) --> gives Updated copy of object.
But same does not happen with remote session
remoteSession.readObject(someObject) --> gives stale copy of object.

To get updated copy we need to do
remoteSession.refreshObject(someObject);

Apart from refreshObject(), We can also do remoteSession.getIdentityMapAccessor().isValid()..
but its not possible to use above approach at all places.

So my question is why remoteSession.readObject() does not retrieve updated object in remote session?

I tried to debug.. If we observe
IdentityMapManager.getFromIdentityMap():

if ((cacheKey != null) && (shouldReturnInvalidatedObjects ||
!descriptor.getCacheInvalidationPolicy().isInvalidated(cache Key))) {

Here descriptor.getCacheInvalidationPolicy().isInvalidated(cacheK ey) is returning true in local session (which is correct) & false in remote session.

So it seems invalidationState of cacheKey correctly becomes 'CACHE_KEY_INVALID' in local session (where UpdateAllQuery is executed), but in remote session
cacheKey does not become 'CACHE_KEY_INVALID.

Is this a known bug?

Thanks a lot for any feedback.
Regards.
Re: Cache replication problem with UpdateAllQuery [message #629218 is a reply to message #628865] Mon, 27 September 2010 13:52 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1039
Registered: July 2009
Senior Member
Feel free to file a bug, but I don't know if this can be considered a bug as it seems a draw back when using remote sessions. Remote sessions have their own caches and do not receive notifications that other sessions have invalidated objects. A solution would be to change the remote session's caching options to not cache objects or reduce the size so it is less of an issue.

Best Regards,
Chris
Previous Topic:Trouble upgrading from EclipseLink 1.1.2 to 2.1.1 in Spring 2.5
Next Topic:How to trigger Entity's callback method?
Goto Forum:
  


Current Time: Mon Dec 22 16:39:18 GMT 2014

Powered by FUDForum. Page generated in 0.07690 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software