[Zope-Checkins] CVS: ZODB3/ZEO - ClientCache.py:1.47.2.1
Jeremy Hylton
jeremy@zope.com
Fri, 20 Jun 2003 15:00:16 -0400
Update of /cvs-repository/ZODB3/ZEO
In directory cvs.zope.org:/tmp/cvs-serv20098
Modified Files:
Tag: ZODB3-3_2-branch
ClientCache.py
Log Message:
Fix corner case in load() -- from zodb4.
Need to backport.
=== ZODB3/ZEO/ClientCache.py 1.47 => 1.47.2.1 ===
--- ZODB3/ZEO/ClientCache.py:1.47 Mon Jun 16 14:27:51 2003
+++ ZODB3/ZEO/ClientCache.py Fri Jun 20 14:59:46 2003
@@ -367,8 +367,14 @@
data = read(dlen)
self._trace(0x2A, oid, version, h[19:], dlen)
if (p < 0) != self._current:
+ # If the cache read we are copying has version info,
+ # we need to pass the header to copytocurrent().
+ if vlen:
+ vheader = read(vlen + 4)
+ else:
+ vheader = None
self._copytocurrent(ap, oidlen, tlen, dlen, vlen, h,
- oid, data)
+ oid, data, vheader)
return data, h[19:]
else:
self._trace(0x26, oid, version)
@@ -412,12 +418,13 @@
"""
if self._pos + tlen > self._limit:
return # Don't let this cause a cache flip
- assert len(header) == 27
+ assert len(header) == 27, len(header)
if header[8] == 'n':
# Rewrite the header to drop the version data.
# This shortens the record.
tlen = 31 + oidlen + dlen
vlen = 0
+ vheader = None
# (oidlen:2, reserved:6, status:1, tlen:4,
# vlen:2, dlen:4, serial:8)
header = header[:9] + pack(">IHI", tlen, vlen, dlen) + header[-8:]
@@ -446,7 +453,8 @@
l.append(vdata)
l.append(vserial)
else:
- assert None is vheader is vdata is vserial
+ assert None is vheader is vdata is vserial, (
+ vlen, vheader, vdata, vserial)
l.append(header[9:13]) # copy of tlen
g = self._f[self._current]
g.seek(self._pos)