[Zodb-checkins] SVN: ZODB/branches/3.3/ Forward port from Zope 2.7 branch.

Tim Peters tim.one at comcast.net
Wed Aug 18 15:22:15 EDT 2004


Log message for revision 27179:
  Forward port from Zope 2.7 branch.
  
  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.
  


Changed:
  U   ZODB/branches/3.3/NEWS.txt
  U   ZODB/branches/3.3/src/scripts/analyze.py


-=-
Modified: ZODB/branches/3.3/NEWS.txt
===================================================================
--- ZODB/branches/3.3/NEWS.txt	2004-08-18 19:21:42 UTC (rev 27178)
+++ ZODB/branches/3.3/NEWS.txt	2004-08-18 19:22:15 UTC (rev 27179)
@@ -3,7 +3,7 @@
 Release date: DD-MMM-YYYY
 
 Tools
---------
+-----
 
 ZODB.utils.oid_repr() changed to add a leading "0x", and to strip leading
 zeroes.  This is used, e.g., in the detail of a POSKeyError exception, to
@@ -26,7 +26,11 @@
     Now makes two passes, so that an accurate report can be given of all
     invalid references.
 
+analyze.py produced spurious "len of unsized object" messages when
+finding a data record for an object uncreation or version abort.  These
+no longer appear.
 
+
 What's new in ZODB3 3.3 beta 2
 ==============================
 Release date: 13-Aug-2004

Modified: ZODB/branches/3.3/src/scripts/analyze.py
===================================================================
--- ZODB/branches/3.3/src/scripts/analyze.py	2004-08-18 19:21:42 UTC (rev 27178)
+++ ZODB/branches/3.3/src/scripts/analyze.py	2004-08-18 19:22:15 UTC (rev 27179)
@@ -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