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

Jeremy Hylton jeremy@zope.com
Tue, 17 Dec 2002 14:13:55 -0500


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

Modified Files:
      Tag: ZODB3-fast-restart-branch
	StorageServer.py 
Log Message:
Backport zeoVerify() improvement from trunk.

Use cheap getSerial() instead of costly zeoLoad().


=== ZODB3/ZEO/StorageServer.py 1.74.2.6.4.3 => 1.74.2.6.4.4 ===
--- ZODB3/ZEO/StorageServer.py:1.74.2.6.4.3	Tue Dec 17 13:52:21 2002
+++ ZODB3/ZEO/StorageServer.py	Tue Dec 17 14:13:54 2002
@@ -326,13 +326,33 @@
 
     def zeoVerify(self, oid, s, sv):
         try:
-            p, os, v, pv, osv = self.zeoLoad(oid)
-        except: # except what?
-            return None
-        if os != s:
+            os = self.storage.getSerial(oid)
+        except KeyError:
             self.client.invalidateVerify((oid, ''))
-        elif osv != sv:
-            self.client.invalidateVerify((oid, v))
+            # XXX It's not clear what we should do now.  The KeyError
+            # could be caused by an object uncreation, in which case
+            # invalidation is right.  It could be an application bug
+            # that left a dangling reference, in which case it's bad.
+        else:
+            # If the client has version data, the logic is a bit more
+            # complicated.  If the current serial number matches the
+            # client serial number, then the non-version data must
+            # also be valid.  If the current serialno is for a
+            # version, then the non-version data can't change.
+
+            # If the version serialno isn't valid, then the
+            # non-version serialno may or may not be valid.  Rather
+            # than trying to figure it whether it is valid, we just
+            # invalidate it.  Sending an invalidation for the
+            # non-version data implies invalidating the version data
+            # too, since an update to non-version data can only occur
+            # after the version is aborted or committed.
+            if sv:
+                if sv != os:
+                    self.client.invalidateVerify((oid, ''))
+            else:
+                if s != os:
+                    self.client.invalidateVerify((oid, ''))
 
     def endZeoVerify(self):
         self.client.endVerify()