Commit 90d90a12 authored by Jim Fulton's avatar Jim Fulton

Added a separate call to check the cache size so that we only check

when a transaction is about to be written. It would be bad if we
"flipped" the cache twice during a transaction, as we would have
incomplete transaction data.  Note that this means that we could
exceed the target cache size if the data for a transaction exceeded
the target size (/2).

Changed the way that the storage is closed. Our close method may be
called from a separate thread than the async main loop. We only want
the async main loop to close our _call (rpc) object. Instead of
closing it directly, we call closeIntensionally(), which, in return,
requests that the async main loop closes it, via the select trigger.
parent 7a73e8ed
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""Network ZODB storage client """Network ZODB storage client
""" """
__version__='$Revision: 1.9 $'[11:-2] __version__='$Revision: 1.10 $'[11:-2]
import struct, time, os, socket, string, Sync, zrpc, ClientCache import struct, time, os, socket, string, Sync, zrpc, ClientCache
import tempfile, Invalidator, ExtensionClass, thread import tempfile, Invalidator, ExtensionClass, thread
...@@ -234,7 +234,7 @@ class ClientStorage(ExtensionClass.Base, BaseStorage.BaseStorage): ...@@ -234,7 +234,7 @@ class ClientStorage(ExtensionClass.Base, BaseStorage.BaseStorage):
def close(self): def close(self):
self._lock_acquire() self._lock_acquire()
try: self._call.close() try: self._call.closeIntensionally()
finally: self._lock_release() finally: self._lock_release()
def commitVersion(self, src, dest, transaction): def commitVersion(self, src, dest, transaction):
...@@ -415,6 +415,7 @@ class ClientStorage(ExtensionClass.Base, BaseStorage.BaseStorage): ...@@ -415,6 +415,7 @@ class ClientStorage(ExtensionClass.Base, BaseStorage.BaseStorage):
read=tfile.read read=tfile.read
cache=self._cache cache=self._cache
size=tfile.tell() size=tfile.tell()
cache.checkSize(size)
seek(0) seek(0)
i=0 i=0
while i < size: while i < size:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment