[Zodb-checkins] CVS: ZODB3/Tools - analyze.py:1.1.30.3

Tim Peters tim.one at comcast.net
Wed Aug 18 14:59:38 EDT 2004


Update of /cvs-repository/ZODB3/Tools
In directory cvs.zope.org:/tmp/cvs-serv17104/Tools

Modified Files:
      Tag: Zope-2_7-branch
	analyze.py 
Log Message:
analyze_rec():  This produced spurious "len of unsized object" messages
when a data record had a backpointer instead of a pickle.  Repaired.

analyze(), analyze_trans():  Simplified overly elaborate iteration code.


=== ZODB3/Tools/analyze.py 1.1.30.2 => 1.1.30.3 ===
--- ZODB3/Tools/analyze.py:1.1.30.2	Thu Mar 18 08:24:02 2004
+++ ZODB3/Tools/analyze.py	Wed Aug 18 14:59:38 2004
@@ -76,21 +76,13 @@
     fs = FileStorage(path, read_only=1)
     fsi = fs.iterator()
     report = Report()
-    while 1:
-        try:
-            transaction = fsi.next()
-        except IndexError:
-            break
-        analyze_trans(report, transaction)
+    for txn in fsi:
+        analyze_trans(report, txn)
     return report
 
 def analyze_trans(report, txn):
     report.TIDS += 1
-    while 1:
-        try:
-            rec = txn.next()
-        except IndexError:
-            break
+    for rec in txn:
         analyze_rec(report, rec)
 
 def get_type(record):
@@ -113,10 +105,13 @@
 def analyze_rec(report, record):
     oid = record.oid
     report.OIDS += 1
+    if record.data is None:
+        # No pickle -- aborted version or undo of object creation.
+        return
     try:
         size = len(record.data) # Ignores various overhead
         report.DBYTES += size
-        if not report.OIDMAP.has_key(oid):
+        if oid not in report.OIDMAP:
             type = get_type(record)
             report.OIDMAP[oid] = type
             report.USEDMAP[oid] = size



More information about the Zodb-checkins mailing list