[Zodb-checkins] CVS: ZODB3/ZEO - ServerStub.py:1.17.2.2
StorageServer.py:1.101.2.2
Jeremy Hylton
cvs-admin at zope.org
Wed Nov 5 23:37:10 EST 2003
Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv29011/ZEO
Modified Files:
Tag: ZODB3-mvcc-2-branch
ServerStub.py StorageServer.py
Log Message:
Add new API calls: loadEx() and verify().
loadEx() is necessary for getting cache semantics right. It's also
easier to implement and understand than zeoLoad(), because it doesn't
try to optimize versions.
Revise the invalidation protocol to send tid along with oid and
version number. Sending the tid is necessary to record the complete
revision lifetime in the cache.
=== ZODB3/ZEO/ServerStub.py 1.17.2.1 => 1.17.2.2 ===
--- ZODB3/ZEO/ServerStub.py:1.17.2.1 Tue Nov 4 17:19:45 2003
+++ ZODB3/ZEO/ServerStub.py Wed Nov 5 23:37:09 2003
@@ -118,6 +118,18 @@
self.rpc.callAsync('zeoVerify', oid, s, sv)
##
+ # Check whether current serial number is valid for oid and version.
+ # If the serial number is not current, the server will make an
+ # asynchronous invalidateVerify() call.
+ # @param oid object id
+ # @param version name of version for oid
+ # @param serial client's current serial number
+ # @defreturn async
+
+ def verify(self, oid, version, serial):
+ self.rpc.callAsync('verify', oid, version, serial)
+
+ ##
# Signal to the server that cache verification is done.
# @defreturn async
@@ -151,16 +163,26 @@
##
# Return current data for oid. Version data is returned if
# present.
- # @param oid
+ # @param oid object id
# @defreturn 5-tuple
# @return 5-tuple, current non-version data, serial number,
# version name, version data, version data serial number
+ # @exception KeyError if oid is not found
def zeoLoad(self, oid):
return self.rpc.call('zeoLoad', oid)
- def load(self, oid, version):
- pass
+ ##
+ # Return current data for oid along with tid if transaction that
+ # wrote the date.
+ # @param oid object id
+ # @param version string, name of version
+ # @defreturn 3-tuple
+ # @return data, serial number, transaction id
+ # @exception KeyError if oid is not found
+
+ def loadEx(self, oid, version):
+ return self.rpc.call("loadEx", oid, version)
##
# Storage new revision of oid.
=== ZODB3/ZEO/StorageServer.py 1.101.2.1 => 1.101.2.2 ===
--- ZODB3/ZEO/StorageServer.py:1.101.2.1 Thu Oct 9 16:27:25 2003
+++ ZODB3/ZEO/StorageServer.py Wed Nov 5 23:37:09 2003
@@ -237,6 +237,10 @@
def getExtensionMethods(self):
return self._extensions
+ def loadEx(self, oid, version):
+ self.stats.loads += 1
+ return self.storage.loadEx(oid, version)
+
def zeoLoad(self, oid):
self.stats.loads += 1
v = self.storage.modifiedInVersion(oid)
@@ -262,6 +266,18 @@
% (len(invlist), u64(invtid)))
return invtid, invlist
+ def verify(self, oid, version, serial):
+ try:
+ s = self.storage.getSerial(oid)
+ except KeyError:
+ self.client.invalidateVerify((oid, ""))
+ if serial != os:
+ # This will invalidate non-version data when the client only
+ # has invalid version data. Since this is an uncommon case,
+ # we avoid the cost of checking whether the serial number
+ # matches the current non-version data.
+ self.client.invalidateVerify((oid, version))
+
def zeoVerify(self, oid, s, sv):
if not self.verifying:
self.verifying = 1
@@ -269,7 +285,7 @@
try:
os = self.storage.getSerial(oid)
except KeyError:
- self.client.invalidateVerify((None, oid, ''))
+ self.client.invalidateVerify((oid, ''))
# 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
@@ -346,7 +362,7 @@
def undoLog(self, first, last):
return run_in_thread(self.storage.undoLog, first, last)
- def tpc_begin(self, id, user, description, ext, tid, status):
+ def tpc_begin(self, id, user, description, ext, tid=None, status=" "):
if self.read_only:
raise ReadOnlyError()
if self.transaction is not None:
@@ -855,6 +871,9 @@
if earliest_tid > tid:
log("tid to old for invq %s < %s" % (u64(tid), u64(earliest_tid)))
return None, []
+
+ # XXX this is wrong! must check against tid or we invalidate
+ # too much.
oids = {}
for tid, L in self.invq:
More information about the Zodb-checkins
mailing list