[Zope-Checkins] CVS: ZODB3/ZEO - StorageServer.py:1.98.4.6

Jeremy Hylton jeremy at zope.com
Fri Jan 9 15:55:19 EST 2004


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

Modified Files:
      Tag: Zope-2_7-branch
	StorageServer.py 
Log Message:
Backport ZEO getInvalidations() fix from the trunk.


=== ZODB3/ZEO/StorageServer.py 1.98.4.5 => 1.98.4.6 ===
--- ZODB3/ZEO/StorageServer.py:1.98.4.5	Tue Sep 30 11:24:40 2003
+++ ZODB3/ZEO/StorageServer.py	Fri Jan  9 15:54:48 2004
@@ -711,7 +711,10 @@
         self.database = None
         if auth_protocol:
             self._setup_auth(auth_protocol)
-        # A list of at most invalidation_queue_size invalidations
+        # A list of at most invalidation_queue_size invalidations.
+        # The list is kept in sorted order with the most recent
+        # invalidation at the front.  The list never has more than
+        # self.invq_bound elements.
         self.invq = []
         self.invq_bound = invalidation_queue_size
         self.connections = {}
@@ -829,8 +832,8 @@
         """
         if invalidated:
             if len(self.invq) >= self.invq_bound:
-                del self.invq[0]
-            self.invq.append((tid, invalidated))
+                self.invq.pop()
+            self.invq.insert(0, (tid, invalidated))
         for p in self.connections.get(storage_id, ()):
             if invalidated and p is not conn:
                 p.client.invalidateTransaction(tid, invalidated)
@@ -840,7 +843,7 @@
     def get_invalidations(self, tid):
         """Return a tid and list of all objects invalidation since tid.
 
-        The tid is the most recent transaction id committed by the server.
+        The tid is the most recent transaction id seen by the client.
 
         Returns None if it is unable to provide a complete list
         of invalidations for tid.  In this case, client should
@@ -851,16 +854,18 @@
             log("invq empty")
             return None, []
 
-        earliest_tid = self.invq[0][0]
+        earliest_tid = self.invq[-1][0]
         if earliest_tid > tid:
             log("tid to old for invq %s < %s" % (u64(tid), u64(earliest_tid)))
             return None, []
 
         oids = {}
-        for tid, L in self.invq:
+        for _tid, L in self.invq:
+            if _tid <= tid:
+                break
             for key in L:
                 oids[key] = 1
-        latest_tid = self.invq[-1][0]
+        latest_tid = self.invq[0][0]
         return latest_tid, oids.keys()
 
     def close_server(self):




More information about the Zope-Checkins mailing list