[ZODB-Dev] I need disconnected mode functionality, but i get ClientDisconnected exception

2006-01-30 Thread Mihai Ilinca
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


Re: [ZODB-Dev] ZEO.ClientStorage replication: invalidations don't work

2006-01-30 Thread Mihai Ilinca
Thanks for your help, I fixed it.

Basicaly, now each read/write operation _starts_ with transaction.commit() to 
ensure processing of invalidation messages. It works fine.
I am using ZODB 3.4 .

I'm still upset about that ClientDisconnected exception, but I will address 
the issue in a new thread.

Thanks again.

-Mihai

> > Trough 'slave' I only do read operations at the moment.
>
> You didn't say which version of ZODB you're using.  If it's a version
> before 3.3, then a client that doesn't modify objects may not process
> invalidations even when you cross a transaction boundary.  Much has been
> written about that before, so I'll just point you at an earlier thread:
>
> http://mail.zope.org/pipermail/zodb-dev/2004-December/008230.html
___
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] ZEO.ClientStorage replication: invalidations don't work

2006-01-26 Thread Mihai Ilinca
Hi.

I am trying to have a ZODB.DB accessible from remote locations trough 
ZEO.ClientStorage . I want the remote clients to also be able to work 
disconnected (by enabling ClientStorage's local caching).

The problem is that changes made in one place do not show up in any other 
places (trough the Invalidation system) unless I stop and restart the scripts 
in those other places. This happens in connected mode (when connections ARE 
possible between the Clients and the Server).

Ok, in more detail: 
I have the server:

runzeo.py -a 1.2.3.4:7895 -f /path/data.fs

running on one machine

And I have 2 types of clients running on other machines:

main = ClientStorage.ClientStorage(
1.2.3.4,
name='main',
)

slave = ClientStorage.ClientStorage(
1.2.3.4,
name = 'some-per_client_unique-name',
client = 'some-per_client_unique-name',
var = 'data',
wait = False,
)

Trough 'slave' I only do read operations at the moment. If I make changes to 
the stored data trough the 'main' client, the 'slave' clients don't see it. 
They only see the data as it was when the ClientStorage was constructed. If I 
restart a 'slave' (the class gets constructed again), the changes are 
visible. Basically, it's like having no Invalidation system whatsoever.

What am I doing wrong here?

Oh, and btw, one other thing: _sometimes_, if runzeo.py is stopped, neither 
the 'main' nor the 'slave' client will start. It's understandable for 'main' 
because it is not configured to use a cache, but how about 'slave' that 
should work in disconnected mode also. I can't seem to always replicate this. 
Sometimes they simply work. When they don't, they raise the exception:
[...]
return node.dump() #my code; node is an instance of PersistentMapping
 File 
"/home/packages/devel/binary/zodb/zodb3-3.4.0/debian/python2.4-zodb3/usr/lib/python2.4/site-packages/ZODB/Connection.py",
 line 704, in setstate
 File 
"/home/packages/devel/binary/zodb/zodb3-3.4.0/debian/python2.4-zodb3/usr/lib/python2.4/site-packages/ZODB/Connection.py",
 line 742, in _setstate
 File 
"/home/packages/devel/binary/zodb/zodb3-3.4.0/debian/python2.4-zodb3/usr/lib/python2.4/site-packages/ZEO/ClientStorage.py"
 , line 746, in load
 File 
"/home/packages/devel/binary/zodb/zodb3-3.4.0/debian/python2.4-zodb3/usr/lib/python2.4/site-packages/ZEO/ClientStorage.py"
 , line 769, in loadEx
 File 
"/home/packages/devel/binary/zodb/zodb3-3.4.0/debian/python2.4-zodb3/usr/lib/python2.4/site-packages/ZEO/ClientStorage.py"
 , line 79, in __getattr__
 ZEO.Exceptions.ClientDisconnected

Can you give me a hint?
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