[Zodb-checkins] SVN: ZODB/trunk/ Merge rev 27179 from 3.3 branch.

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


Log message for revision 27183:
  Merge rev 27179 from 3.3 branch.
  
  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/trunk/NEWS.txt
  U   ZODB/trunk/src/scripts/analyze.py


-=-
Modified: ZODB/trunk/NEWS.txt
===================================================================
--- ZODB/trunk/NEWS.txt	2004-08-18 19:23:39 UTC (rev 27182)
+++ ZODB/trunk/NEWS.txt	2004-08-18 19:37:57 UTC (rev 27183)
@@ -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/trunk/src/scripts/analyze.py
===================================================================
--- ZODB/trunk/src/scripts/analyze.py	2004-08-18 19:23:39 UTC (rev 27182)
+++ ZODB/trunk/src/scripts/analyze.py	2004-08-18 19:37:57 UTC (rev 27183)
@@ -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