Page 1 of 1

AutomaticCacheCoherency and out of date objects

Posted: Thu Apr 14, 2011 9:32 am
by cnwep1
Hi,

I've been looking into a problem and the symptoms could be caused by a node having an old edition of an object (that had just been updated on another node). We have the AutomaticCacheCoherency option on for all nodes. Just wondering if anybody has come across cases where Jade AutomaticCacheCoherency feature doesn't keep up with things and it's possible to be using an out of date edition? And if this is possible what strategy do you use to avoid issues? the resynch and resynchObject methods have no effect. So the only other option would seem to be to lock the object.

Cheers

Re: AutomaticCacheCoherency and out of date objects

Posted: Thu Apr 14, 2011 12:17 pm
by JohnP
My understanding is that if you have a non-collection object already in your node's cache, you can continue to access it even though someone in another node has it exclusively locked. You can't fetch it from the database or lock it, but you can access it if you already have it in cache.

You could retry the transaction, like you would do for a deadlock.

Re: AutomaticCacheCoherency and out of date objects

Posted: Thu Apr 14, 2011 1:50 pm
by Rich
From the Object Manager Guide : "When a transaction is
committed, the server sends a message to each client, identifying the objects that have been
updated. On receipt of this message, the client marks all updated objects that are present in the
cache as being obsolete. The next time a process on the client attempts to access the obsolete object,
the updated copy is retrieved from the server."

This means that there is a small window between the time that the server commits the updates and the time that the client node marks the object as obsolete. For many applications, this may not matter, but when object currency is paramount you need to lock the object.

Re: AutomaticCacheCoherency and out of date objects

Posted: Thu Apr 14, 2011 4:53 pm
by BeeJay
If your code absolutely requires the latest version of the object, the only way you can 100% guarantee that you have the latest version is to place a lock on the object for the duration of your requirement.

Cheers,
BeeJay.