Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZODB
Commits
7aabb799
Commit
7aabb799
authored
Jun 07, 2013
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Normalize out pickle sizes / offsets.
parent
ee4df920
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
44 deletions
+34
-44
src/ZODB/tests/test_fsdump.py
src/ZODB/tests/test_fsdump.py
+9
-12
src/ZODB/tests/testfsoids.py
src/ZODB/tests/testfsoids.py
+25
-32
No files found.
src/ZODB/tests/test_fsdump.py
View file @
7aabb799
...
...
@@ -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'\
o
ffset=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'\
o
ffset=[0-9]+\b'
),
'offset=<OFFSET>'
),
])
...
...
src/ZODB/tests/testfsoids.py
View file @
7aabb799
...
...
@@ -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>'
),
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment