[Zodb-checkins] CVS: Zope3/lib/python/ZEO - StorageServer.py:1.44

Jeremy Hylton jeremy@zope.com
Tue, 26 Nov 2002 17:50:32 -0500


Update of /cvs-repository/Zope3/lib/python/ZEO
In directory cvs.zope.org:/tmp/cvs-serv17439

Modified Files:
	StorageServer.py 
Log Message:
Fix zeoVerify() to use getSerial() instead of load().


=== Zope3/lib/python/ZEO/StorageServer.py 1.43 => 1.44 ===
--- Zope3/lib/python/ZEO/StorageServer.py:1.43	Tue Nov 26 12:41:20 2002
+++ Zope3/lib/python/ZEO/StorageServer.py	Tue Nov 26 17:50:32 2002
@@ -338,13 +338,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()