[Zodb-checkins] CVS: StandaloneZODB/Tools - fstest.py:1.2
Jeremy Hylton
jeremy@zope.com
Fri, 28 Sep 2001 19:09:02 -0400
Update of /cvs-repository/StandaloneZODB/Tools
In directory cvs.zope.org:/tmp/cvs-serv6325
Modified Files:
fstest.py
Log Message:
Check that transaction id matches object serialnos.
This test wasn't part of read_index(), but seems good and cheap.
XXX Needs test case.
=== StandaloneZODB/Tools/fstest.py 1.1 => 1.2 ===
while pos < tend:
_pos = pos
- pos, oid = check_drec(path, file, pos, tpos)
+ pos, oid = check_drec(path, file, pos, tpos, tid)
if pos > tend:
raise FormatError("%s has data records that extend beyond"
" the transaction record; end at %s" %
@@ -152,7 +152,7 @@
pos = tend + 8
return pos, tid
-def check_drec(path, file, pos, tpos):
+def check_drec(path, file, pos, tpos, tid):
"""Check a data record for the current transaction record"""
h = file.read(DREC_HDR_LEN)
@@ -164,6 +164,11 @@
tloc = U64(_tloc)
plen = U64(_plen)
dlen = DREC_HDR_LEN + (plen or 8)
+
+ if serial != tid:
+ raise FormatError("%s object serialno %s does not match"
+ "transaction id %s" % (pos, hexify(serial),
+ hexify(tid)))
if vlen:
dlen = dlen + 16 + vlen