Commit 33429554 authored by Dmitry Vasiliev's avatar Dmitry Vasiliev

Size info for object records was added. Also use enumerate() builtin.

parent 308d4c2a
...@@ -21,9 +21,8 @@ from ZODB.utils import u64, get_pickle_metadata ...@@ -21,9 +21,8 @@ from ZODB.utils import u64, get_pickle_metadata
from ZODB.tests.StorageTestBase import zodb_unpickle from ZODB.tests.StorageTestBase import zodb_unpickle
def fsdump(path, file=None, with_offset=1): def fsdump(path, file=None, with_offset=1):
i = 0
iter = FileIterator(path) iter = FileIterator(path)
for trans in iter: for i, trans in enumerate(iter):
if with_offset: if with_offset:
print >> file, "Trans #%05d tid=%016x time=%s offset=%d" % \ print >> file, "Trans #%05d tid=%016x time=%s offset=%d" % \
(i, u64(trans.tid), str(TimeStamp(trans.tid)), trans._pos) (i, u64(trans.tid), str(TimeStamp(trans.tid)), trans._pos)
...@@ -32,12 +31,13 @@ def fsdump(path, file=None, with_offset=1): ...@@ -32,12 +31,13 @@ def fsdump(path, file=None, with_offset=1):
(i, u64(trans.tid), str(TimeStamp(trans.tid))) (i, u64(trans.tid), str(TimeStamp(trans.tid)))
print >> file, "\tstatus=%s user=%s description=%s" % \ print >> file, "\tstatus=%s user=%s description=%s" % \
(`trans.status`, trans.user, trans.description) (`trans.status`, trans.user, trans.description)
j = 0 for j, rec in enumerate(trans):
for rec in trans:
if rec.data is None: if rec.data is None:
fullclass = "undo or abort of object creation" fullclass = "undo or abort of object creation"
size = ""
else: else:
modname, classname = get_pickle_metadata(rec.data) modname, classname = get_pickle_metadata(rec.data)
size = " size=%d" % len(rec.data)
fullclass = "%s.%s" % (modname, classname) fullclass = "%s.%s" % (modname, classname)
# FIXME: Is this used? # FIXME: Is this used?
# special case for testing purposes # special case for testing purposes
...@@ -45,20 +45,18 @@ def fsdump(path, file=None, with_offset=1): ...@@ -45,20 +45,18 @@ def fsdump(path, file=None, with_offset=1):
obj = zodb_unpickle(rec.data) obj = zodb_unpickle(rec.data)
fullclass = "%s %s" % (fullclass, obj.value) fullclass = "%s %s" % (fullclass, obj.value)
if rec.version: if rec.version:
version = "version=%s " % rec.version version = " version=%s" % rec.version
else: else:
version = '' version = ""
if rec.data_txn: if rec.data_txn:
# XXX It would be nice to print the transaction number # XXX It would be nice to print the transaction number
# (i) but it would be too expensive to keep track of. # (i) but it would be too expensive to keep track of.
bp = "bp=%016x" % u64(rec.data_txn) bp = " bp=%016x" % u64(rec.data_txn)
else: else:
bp = "" bp = ""
print >> file, " data #%05d oid=%016x %sclass=%s %s" % \ print >> file, " data #%05d oid=%016x%s%s class=%s%s" % \
(j, u64(rec.oid), version, fullclass, bp) (j, u64(rec.oid), version, size, fullclass, bp)
j += 1
print >> file print >> file
i += 1
iter.close() iter.close()
def fmt(p64): def fmt(p64):
......
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