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 ? ...@@ -3,7 +3,7 @@ What's new in ZODB3 3.3 ?
Release date: DD-MMM-YYYY Release date: DD-MMM-YYYY
Tools Tools
-------- -----
ZODB.utils.oid_repr() changed to add a leading "0x", and to strip leading 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 zeroes. This is used, e.g., in the detail of a POSKeyError exception, to
...@@ -26,6 +26,10 @@ fsrefs.py: ...@@ -26,6 +26,10 @@ fsrefs.py:
Now makes two passes, so that an accurate report can be given of all Now makes two passes, so that an accurate report can be given of all
invalid references. 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 What's new in ZODB3 3.3 beta 2
============================== ==============================
......
...@@ -76,21 +76,13 @@ def analyze(path): ...@@ -76,21 +76,13 @@ def analyze(path):
fs = FileStorage(path, read_only=1) fs = FileStorage(path, read_only=1)
fsi = fs.iterator() fsi = fs.iterator()
report = Report() report = Report()
while 1: for txn in fsi:
try: analyze_trans(report, txn)
transaction = fsi.next()
except IndexError:
break
analyze_trans(report, transaction)
return report return report
def analyze_trans(report, txn): def analyze_trans(report, txn):
report.TIDS += 1 report.TIDS += 1
while 1: for rec in txn:
try:
rec = txn.next()
except IndexError:
break
analyze_rec(report, rec) analyze_rec(report, rec)
def get_type(record): def get_type(record):
...@@ -113,10 +105,13 @@ def get_type(record): ...@@ -113,10 +105,13 @@ def get_type(record):
def analyze_rec(report, record): def analyze_rec(report, record):
oid = record.oid oid = record.oid
report.OIDS += 1 report.OIDS += 1
if record.data is None:
# No pickle -- aborted version or undo of object creation.
return
try: try:
size = len(record.data) # Ignores various overhead size = len(record.data) # Ignores various overhead
report.DBYTES += size report.DBYTES += size
if not report.OIDMAP.has_key(oid): if oid not in report.OIDMAP:
type = get_type(record) type = get_type(record)
report.OIDMAP[oid] = type report.OIDMAP[oid] = type
report.USEDMAP[oid] = size 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