Commit a30763f2 authored by Tim Peters's avatar Tim Peters

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.
parent 35df3e12
......@@ -3,7 +3,7 @@ What's new in ZODB3 3.3 ?
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,6 +26,10 @@ fsrefs.py:
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
==============================
......
......@@ -76,21 +76,13 @@ def analyze(path):
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 get_type(record):
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment