RE: [ZODB-Dev] I need disconnected mode functionality, but i get ClientDisconnected exception
[Mihai Ilinca] > I want to have a ClientStorage that would work in both connected and > disconnected (to zeo-server) mode. When zeo-server is not up (or > reachable), I would like ClientStorage to use a local cache. Is that > possible with ZEO? To the _extent_ possible, yes. A cache is not a database (it's "just a cache"), and you'll get ClientDisconnected whenever you try something that requires a database: - You try to commit a transaction that modified an object. - You try to load an object whose current state is neither in the connection's ZODB memory cache nor in the ZEO client's file cache. To prevent all possible occurrences of the latter, you would have to, while ZEO is connected, load the current revision of every object in the database, and ensure that the ZEO file cache is large enough to hold the current states of all objects in the database simultaneously. > Right now I instanciate ClientStorage with ClientStorage( > zeoServerAddress, > name = 'name', > client = 'client', > var = 'path', > wait = False > ) > When I try to access the attributes of the root persistent object > (instance of PersistentMapping) I get a ClientDisconnected exception: That's expected and unavoidable if, and only if, the states of the objects to which those attributes are bound don't happen to be in the ZEO cache. They only way they can get _into_ the ZEO cache is by loading those objects while the ZEO client is connected. ... > I know that the client is disconnected, as zeo-server is not up, but how > can I make it so that I won't get this exception anymore, but instead > have ZEO read the persistent objects from the local cache, transparently? It already does that: if the object states were in the ZEO cache, you would not have seen ClientDisconnected. When the object states are not in the ZEO cache, then a connection to a ZEO server is necessary to fetch the states. Or there's a bug of some kind. That's possible, but unlikely given that nobody else has had a similar complaint or question lately. ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org http://mail.zope.org/mailman/listinfo/zodb-dev
Re: [ZODB-Dev] I need disconnected mode functionality, but i get ClientDisconnected exception
Mihai Ilinca wrote at 2006-1-30 20:11 +0200: > ... >I want to have a ClientStorage that would work in both connected and >disconnected (to zeo-server) mode. When zeo-server is not up (or reachable), >I would like ClientStorage to use a local cache. Is that possible with ZEO? > >Right now I instanciate ClientStorage with >ClientStorage( >zeoServerAddress, >name = 'name', >client = 'client', >var = 'path', >wait = False > ) >When I try to access the attributes of the root persistent object (instance of >PersistentMapping) I get a ClientDisconnected exception: In principle, it should be possible (though I did not try it myself). Of course, as soon as you modify any object or have a cache miss on reading, the ZEO server will be contacted and you get a "ClientDisconnect" when this is impossible. "ClientStorage" does not support complete autonomous work (purly with a cache). All writes need to go directly to ZEO. -- Dieter ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org http://mail.zope.org/mailman/listinfo/zodb-dev
[ZODB-Dev] I need disconnected mode functionality, but i get ClientDisconnected exception
Hi. I want to have a ClientStorage that would work in both connected and disconnected (to zeo-server) mode. When zeo-server is not up (or reachable), I would like ClientStorage to use a local cache. Is that possible with ZEO? Right now I instanciate ClientStorage with ClientStorage( zeoServerAddress, name = 'name', client = 'client', var = 'path', wait = False ) When I try to access the attributes of the root persistent object (instance of PersistentMapping) I get a ClientDisconnected exception: /usr/lib/python2.4/site-packages/ZODB/Connection.py in setstate(self, obj) /usr/lib/python2.4/site-packages/ZODB/Connection.py in _setstate(self, obj) /usr/lib/python2.4/site-packages/ZEO/ClientStorage.py in load(self, oid, version) /usr/lib/python2.4/site-packages/ZEO/ClientStorage.py in loadEx(self, oid, version) /usr/lib/python2.4/site-packages/ZEO/ClientStorage.py in __getattr__(self, attr) ClientDisconnected: I know that the client is disconnected, as zeo-server is not up, but how can I make it so that I won't get this exception anymore, but instead have ZEO read the persistent objects from the local cache, transparently? Thanks. -Mihai ___ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org http://mail.zope.org/mailman/listinfo/zodb-dev