[ZODB-Dev] Invalidation message question

Christian Robottom Reis kiko at async.com.br
Sun Nov 28 10:42:22 EST 2004


On Sun, Nov 28, 2004 at 03:11:22AM -0600, Luis Machado wrote:
> I'm using last_key = rootObject.maxKey(). The first time I execute this
> sentence, it works fine. If I execute the same sentence again after the
> other application has added a new (key,value) pair to the root object, I
> get the same value. If I run last_key = rootObject.maxKey() in a loop, I
> always get the same value, even after the other application has added
> many new (key,value) pairs to the database.
> 
> Of course, if I disconnect the application that reads from the database
> and reconnect it again, then I get the right value.
> 
> Looks like that the ZEO server is not sending the invalidation message
> each time a new (key,value) pair is added to the database.

This is a FAQ. The ZEO client doesn't invalidate the local objects
continuously, but only at transaction boundaries (this is what allows
you to work on a ZEO client without having it blow up because of write
conflicts left and right because other clients wrote to the same
objects). 

Use the sync() method on a connection to invalidate the state of your
current objects, but remember it implicits an abort of any transactions
in progress, which may not be what you want.  Hopefully your client is
read-only and can skip this issue entirely.

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331


More information about the ZODB-Dev mailing list