[Zope-Checkins] CVS: ZODB3/ZEO - simul.py:1.18

Jeremy Hylton cvs-admin at zope.org
Tue Nov 18 21:03:44 EST 2003


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

Modified Files:
	simul.py 
Log Message:
Fix simul to read the new cache trace format.

Bug fix candidate.

XXX Each record encodes the length of its oid.  Is it really possible
to have variable-length oids?  There's a high space cost for the oid
length, which is always 8 for the standard storage.


=== ZODB3/ZEO/simul.py 1.17 => 1.18 ===
--- ZODB3/ZEO/simul.py:1.17	Fri Jan  3 17:07:38 2003
+++ ZODB3/ZEO/simul.py	Tue Nov 18 21:03:44 2003
@@ -108,21 +108,21 @@
     struct_unpack = struct.unpack
     while 1:
         # Read a record and decode it
-        r = f_read(8)
-        if len(r) < 8:
+        r = f_read(10)
+        if len(r) < 10:
             break
-        offset += 8
-        ts, code = struct_unpack(">ii", r)
+        offset += 10
+        ts, code, lenoid = struct_unpack(">iiH", r)
         if ts == 0:
             # Must be a misaligned record caused by a crash
             ##print "Skipping 8 bytes at offset", offset-8
             continue
-        r = f_read(16)
-        if len(r) < 16:
+        r = f_read(8 + lenoid)
+        if len(r) < 8 + lenoid:
             break
-        offset += 16
+        offset += 8 + lenoid
         records += 1
-        oid, serial = struct_unpack(">8s8s", r)
+        serial, oid = struct_unpack(">8s%ds" % lenoid, r)
         # Decode the code
         dlen, version, code, current = (code & 0x7fffff00,
                                         code & 0x80,




More information about the Zope-Checkins mailing list