[Zodb-checkins] CVS: ZODB3/ZEO - StorageServer.py:1.74.2.6.4.5

Guido van Rossum guido@python.org
Tue, 17 Dec 2002 14:33:30 -0500


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

Modified Files:
      Tag: ZODB3-fast-restart-branch
	StorageServer.py 
Log Message:
Change the invalidation protocol.  Instead of
invalidateTrans(invalidated), we call
invalidateTransaction(tid, invalidated).

This is for the benefit of the validation optimization.


=== ZODB3/ZEO/StorageServer.py 1.74.2.6.4.4 => 1.74.2.6.4.5 ===
--- ZODB3/ZEO/StorageServer.py:1.74.2.6.4.4	Tue Dec 17 14:13:54 2002
+++ ZODB3/ZEO/StorageServer.py	Tue Dec 17 14:33:29 2002
@@ -140,7 +140,7 @@
             l = self.connections[storage_id] = []
         l.append(conn)
 
-    def invalidate(self, conn, storage_id, invalidated=(), info=None):
+    def invalidate(self, conn, storage_id, tid, invalidated=(), info=None):
         """Internal: broadcast info and invalidations to clients.
 
         This is called from several ZEOStorage methods.
@@ -148,7 +148,7 @@
         This can do three different things:
 
         - If the invalidated argument is non-empty, it broadcasts
-          invalidateTrans() messages to all clients of the given
+          invalidateTransaction() messages to all clients of the given
           storage except the current client (the conn argument).
 
         - If the invalidated argument is empty and the info argument
@@ -157,14 +157,14 @@
           client.
 
         - If both the invalidated argument and the info argument are
-          non-empty, it broadcasts invalidateTrans() messages to all
+          non-empty, it broadcasts invalidateTransaction() messages to all
           clients except the current, and sends an info() message to
           the current client.
 
         """
         for p in self.connections.get(storage_id, ()):
             if invalidated and p is not conn:
-                p.client.invalidateTrans(invalidated)
+                p.client.invalidateTransaction(tid, invalidated)
             elif info is not None:
                 p.client.info(info)
 
@@ -373,7 +373,8 @@
         self.storage.pack(time, referencesf)
         self.log("pack(time=%s) complete" % repr(time))
         # Broadcast new size statistics
-        self.server.invalidate(0, self.storage_id, (), self.get_size_info())
+        self.server.invalidate(0, self.storage_id, None,
+                               (), self.get_size_info())
 
     def new_oids(self, n=100):
         """Return a sequence of n new oids, where n defaults to 100"""
@@ -388,7 +389,7 @@
             raise ReadOnlyError()
         oids = self.storage.undo(transaction_id)
         if oids:
-            self.server.invalidate(self, self.storage_id,
+            self.server.invalidate(self, self.storage_id, None,
                                    map(lambda oid: (oid, ''), oids))
             return oids
         return ()
@@ -429,13 +430,13 @@
         if not self.check_tid(id):
             return
         invalidated = self.strategy.tpc_finish()
+        tid = self.storage.lastTransaction()
         if invalidated:
-            self.server.invalidate(self, self.storage_id,
+            self.server.invalidate(self, self.storage_id, tid,
                                    invalidated, self.get_size_info())
         self.transaction = None
         self.strategy = None
         # Return the tid, for cache invalidation optimization
-        tid = self.storage.lastTransaction()
         self.handle_waiting()
         return tid