[Zope-Checkins] CVS: ZODB3/ZEO - ClientStorage.py:1.73.2.7.2.8

Guido van Rossum guido@python.org
Tue, 17 Dec 2002 16:00:03 -0500


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

Modified Files:
      Tag: ZODB3-fast-restart-branch
	ClientStorage.py 
Log Message:
Change so that self._last_inval_tid is stored (persistently, if
necessary) by the client cache instead of as an instance variable.


=== ZODB3/ZEO/ClientStorage.py 1.73.2.7.2.7 => 1.73.2.7.2.8 ===
--- ZODB3/ZEO/ClientStorage.py:1.73.2.7.2.7	Tue Dec 17 15:57:10 2002
+++ ZODB3/ZEO/ClientStorage.py	Tue Dec 17 16:00:02 2002
@@ -236,9 +236,6 @@
         self._tpc_cond = threading.Condition()
         self._transaction = None
 
-        # Transaction id of last invalidation (either ours or received)
-        self._last_inval_tid = None
-
         # Prevent multiple new_oid calls from going out.  The _oids
         # variable should only be modified while holding the
         # _oid_lock.
@@ -396,20 +393,21 @@
 
     def verify_cache(self, server):
         """Internal routine called to verify the cache."""
-        if self._last_inval_tid is not None:
+        last_inval_tid = self._cache.getLastTid()
+        if last_inval_tid is not None:
             ltid = server.lastTransaction()
-            if ltid == self._last_inval_tid:
+            if ltid == last_inval_tid:
                 log2(INFO, "No verification necessary "
-                     "(_last_inval_tid up-to-date)")
+                     "(last_inval_tid up-to-date)")
                 self._cache.open()
                 return # No need to verify the cache
 
             # log some hints about last transaction
             log2(INFO, "last inval tid: %r %s"
-                 % (self._last_inval_tid, tid2time(self._last_inval_tid)))
+                 % (last_inval_tid, tid2time(last_inval_tid)))
             log2(INFO, "last transaction: %r %s" % (ltid, tid2time(ltid)))
 
-            pair = server.getInvalidations(self._last_inval_tid)
+            pair = server.getInvalidations(last_inval_tid)
             if pair is not None:
                 log2(INFO, "Recovering %d invalidations" % len(pair[1]))
                 self._cache.open()
@@ -708,7 +706,7 @@
             assert r is None or len(r) == 0, "unhandled serialnos: %s" % r
 
             self._update_cache()
-            self._last_inval_tid = tid
+            self._cache.setLastTid(tid)
         finally:
             self.end_transaction()
 
@@ -836,7 +834,7 @@
 
     def invalidateTransaction(self, tid, args):
         """Invalidate objects modified by tid."""
-        self._last_inval_tid = tid
+        self._cache.setLastTid(tid)
         for oid, version in args:
             self._cache.invalidate(oid, version=version)
             try: