[Zodb-checkins] CVS: ZODB3/ZEO - ClientStorage.py:1.73.2.9

Guido van Rossum guido@python.org
Thu, 26 Dec 2002 15:22:54 -0500


Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv832

Modified Files:
      Tag: ZODB3-3_1-branch
	ClientStorage.py 
Log Message:
Add INFO level log messages at begin and end of cache verification.
The end message reports the number of invalidations and the elapsed
time.


=== ZODB3/ZEO/ClientStorage.py 1.73.2.8 => 1.73.2.9 ===
--- ZODB3/ZEO/ClientStorage.py:1.73.2.8	Fri Dec 20 11:13:42 2002
+++ ZODB3/ZEO/ClientStorage.py	Thu Dec 26 15:22:53 2002
@@ -774,6 +774,8 @@
 
     def beginVerify(self):
         """Server callback to signal start of cache validation."""
+        log2(INFO, "begin cache verification")
+        self._verify_start = time.time()
         self._tfile = tempfile.TemporaryFile(suffix=".inv")
         self._pickler = cPickle.Pickler(self._tfile, 1)
         self._pickler.fast = 1 # Don't use the memo
@@ -793,6 +795,7 @@
     def endVerify(self):
         """Server callback to signal end of cache validation."""
         if self._pickler is None:
+            # XXX This should never happen
             return
         self._pickler.dump((0,0))
         self._tfile.seek(0)
@@ -800,13 +803,20 @@
         f = self._tfile
         self._tfile = None
 
+        ninval = 0
+
         while 1:
             oid, version = unpick.load()
             if not oid:
                 break
+            ninval += 1
             self._cache.invalidate(oid, version=version)
             self._db.invalidate(oid, version=version)
         f.close()
+
+        elapsed = time.time() - self._verify_start
+        log2(INFO, "end cache verification (%d invalidations, %.3g seconds)" %
+             (ninval, elapsed))
 
     def invalidateTrans(self, args):
         """Server callback to invalidate a list of (oid, version) pairs.