Commit 7aabb799 authored by Tres Seaver's avatar Tres Seaver

Normalize out pickle sizes / offsets.

parent ee4df920
......@@ -39,9 +39,9 @@ Create a root object and try again:
>>> db = ZODB.DB(st) # yes, that creates a root object!
>>> fsdump(path) #doctest: +ELLIPSIS
Trans #00000 tid=... time=... offset=52
Trans #00000 tid=... time=... offset=<OFFSET>
status=' ' user='' description='initial database creation'
data #00000 oid=0000000000000000 size=60 class=persistent.mapping.PersistentMapping
data #00000 oid=0000000000000000 size=<SIZE> class=persistent.mapping.PersistentMapping
Now we see first transaction with root object.
......@@ -52,13 +52,13 @@ Let's add a BTree:
>>> txn.get().note('added an OOBTree')
>>> txn.get().commit()
>>> fsdump(path) #doctest: +ELLIPSIS
Trans #00000 tid=... time=... offset=52
Trans #00000 tid=... time=... offset=<OFFSET>
status=' ' user='' description='initial database creation'
data #00000 oid=0000000000000000 size=60 class=persistent.mapping.PersistentMapping
Trans #00001 tid=... time=... offset=201
data #00000 oid=0000000000000000 size=<SIZE> class=persistent.mapping.PersistentMapping
Trans #00001 tid=... time=... offset=<OFFSET>
status=' ' user='' description='added an OOBTree'
data #00000 oid=0000000000000000 size=107 class=persistent.mapping.PersistentMapping
data #00001 oid=0000000000000001 size=29 class=BTrees.OOBTree.OOBTree
data #00000 oid=0000000000000000 size=<SIZE> class=persistent.mapping.PersistentMapping
data #00001 oid=0000000000000001 size=<SIZE> class=BTrees.OOBTree.OOBTree
Now we see two transactions and two changed objects.
......@@ -79,11 +79,8 @@ checker = renormalizing.RENormalizing([
(re.compile(r'\b\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\.\d+\b'), '...'),
# Python 3 produces larger pickles, even when we use zodbpickle :(
# this changes all the offsets and sizes
(re.compile(r'\bsize=65\b'), 'size=60'),
(re.compile(r'\offset=206\b'), 'offset=201'),
(re.compile(r'\bsize=156\b'), 'size=107'),
# even with Pickler(bytes_as_strings=True) some of our pickles are larger
(re.compile(r'\bsize=113\b'), 'size=107'),
(re.compile(r'\bsize=[0-9]+\b'), 'size=<SIZE>'),
(re.compile(r'\offset=[0-9]+\b'), 'offset=<OFFSET>'),
])
......
......@@ -56,10 +56,10 @@ Create a root object and try again:
>>> t.register_oids(0, 1)
>>> t.run(); t.report() #doctest: +ELLIPSIS
oid 0x00 persistent.mapping.PersistentMapping 1 revision
tid 0x... offset=4 ...
tid 0x... offset=<OFFSET> ...
tid user=''
tid description='initial database creation'
new revision persistent.mapping.PersistentMapping at 52
new revision persistent.mapping.PersistentMapping at <OFFSET>
oid 0x01 <unknown> 0 revisions
this oid was not defined (no data record for it found)
......@@ -82,21 +82,21 @@ Let's add a BTree and try again:
>>> t.register_oids(0, 1)
>>> t.run(); t.report() #doctest: +ELLIPSIS
oid 0x00 persistent.mapping.PersistentMapping 2 revisions
tid 0x... offset=4 ...
tid 0x... offset=<OFFSET> ...
tid user=''
tid description='initial database creation'
new revision persistent.mapping.PersistentMapping at 52
tid 0x... offset=162 ...
new revision persistent.mapping.PersistentMapping at <OFFSET>
tid 0x... offset=<OFFSET> ...
tid user=''
tid description='added an OOBTree'
new revision persistent.mapping.PersistentMapping at 201
references 0x01 BTrees.OOBTree.OOBTree at 201
new revision persistent.mapping.PersistentMapping at <OFFSET>
references 0x01 BTrees.OOBTree.OOBTree at <OFFSET>
oid 0x01 BTrees.OOBTree.OOBTree 1 revision
tid 0x... offset=162 ...
tid 0x... offset=<OFFSET> ...
tid user=''
tid description='added an OOBTree'
new revision BTrees.OOBTree.OOBTree at 350
referenced by 0x00 persistent.mapping.PersistentMapping at 201
new revision BTrees.OOBTree.OOBTree at <OFFSET>
referenced by 0x00 persistent.mapping.PersistentMapping at <OFFSET>
So there are two revisions of oid 0 now, and the second references oid 1.
......@@ -110,30 +110,30 @@ One more, storing a reference in the BTree back to the root object:
>>> t.register_oids(0, 1, 2)
>>> t.run(); t.report() #doctest: +ELLIPSIS
oid 0x00 persistent.mapping.PersistentMapping 2 revisions
tid 0x... offset=4 ...
tid 0x... offset=<OFFSET> ...
tid user=''
tid description='initial database creation'
new revision persistent.mapping.PersistentMapping at 52
tid 0x... offset=162 ...
new revision persistent.mapping.PersistentMapping at <OFFSET>
tid 0x... offset=<OFFSET> ...
tid user=''
tid description='added an OOBTree'
new revision persistent.mapping.PersistentMapping at 201
references 0x01 BTrees.OOBTree.OOBTree at 201
tid 0x... offset=429 ...
new revision persistent.mapping.PersistentMapping at <OFFSET>
references 0x01 BTrees.OOBTree.OOBTree at <OFFSET>
tid 0x... offset=<OFFSET> ...
tid user=''
tid description='circling back to the root'
referenced by 0x01 BTrees.OOBTree.OOBTree at 477
referenced by 0x01 BTrees.OOBTree.OOBTree at <OFFSET>
oid 0x01 BTrees.OOBTree.OOBTree 2 revisions
tid 0x... offset=162 ...
tid 0x... offset=<OFFSET> ...
tid user=''
tid description='added an OOBTree'
new revision BTrees.OOBTree.OOBTree at 350
referenced by 0x00 persistent.mapping.PersistentMapping at 201
tid 0x... offset=429 ...
new revision BTrees.OOBTree.OOBTree at <OFFSET>
referenced by 0x00 persistent.mapping.PersistentMapping at <OFFSET>
tid 0x... offset=<OFFSET> ...
tid user=''
tid description='circling back to the root'
new revision BTrees.OOBTree.OOBTree at 477
references 0x00 persistent.mapping.PersistentMapping at 477
new revision BTrees.OOBTree.OOBTree at <OFFSET>
references 0x00 persistent.mapping.PersistentMapping at <OFFSET>
oid 0x02 <unknown> 0 revisions
this oid was not defined (no data record for it found)
......@@ -182,15 +182,8 @@ checker = renormalizing.RENormalizing([
(re.compile(r'\b\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\.\d+\b'), '...'),
# Python 3 produces larger pickles, even when we use zodbpickle :(
# this changes all the offsets and sizes
(re.compile(r'\boffset=167\b'), 'offset=162'),
(re.compile(r'\boffset=483\b'), 'offset=429'),
(re.compile(r'(PersistentMapping|OOBTree) at 206\b'), r'\1 at 201'),
(re.compile(r'(OOBTree) at 404\b'), r'\1 at 350'),
(re.compile(r'(PersistentMapping|OOBTree) at 531\b'), r'\1 at 477'),
# even with Pickler(bytes_as_strings=True) some of our pickles are larger
(re.compile(r'(OOBTree) at 361\b'), r'\1 at 350'),
(re.compile(r'\boffset=440\b'), 'offset=429'),
(re.compile(r'(PersistentMapping|OOBTree) at 488\b'), r'\1 at 477'),
(re.compile(r'\boffset=[0-9]+\b'), 'offset=<OFFSET>'),
(re.compile(r'\bat [0-9]+'), 'at <OFFSET>'),
])
......
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