Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
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
Levin Zimmermann
neoppod
Commits
0526cca3
Commit
0526cca3
authored
Mar 07, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1c25bc76
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
641 additions
and
599 deletions
+641
-599
t/neo/storage/fs1/py/gen-testdata
t/neo/storage/fs1/py/gen-testdata
+50
-8
t/neo/storage/fs1/testdata/1.fs
t/neo/storage/fs1/testdata/1.fs
+0
-0
t/neo/storage/fs1/testdata/1.fs.index
t/neo/storage/fs1/testdata/1.fs.index
+0
-0
t/neo/storage/fs1/testdata_expect_test.go
t/neo/storage/fs1/testdata_expect_test.go
+591
-591
t/neo/zodb/cmd/zodbdump/testdata/1.zdump.ok
t/neo/zodb/cmd/zodbdump/testdata/1.zdump.ok
+0
-0
No files found.
t/neo/storage/fs1/py/gen-testdata
View file @
0526cca3
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
from
ZODB.FileStorage
import
FileStorage
from
ZODB.FileStorage
import
FileStorage
from
ZODB
import
DB
from
ZODB
import
DB
from
ZODB.POSException
import
UndoError
from
persistent
import
Persistent
from
persistent
import
Persistent
import
transaction
import
transaction
...
@@ -64,6 +65,29 @@ class Object(Persistent):
...
@@ -64,6 +65,29 @@ class Object(Persistent):
def
__setstate__
(
self
,
state
):
def
__setstate__
(
self
,
state
):
self
.
value
=
state
self
.
value
=
state
# prepare extension dictionary for subject
alnum
=
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
def
ext
(
subj
):
d
=
{
"x-generator"
:
"zodb/py2 (%s)"
%
subj
}
# also add some random 'x-cookie'
cooklen
=
5
cookie
=
""
for
_
in
range
(
cooklen
):
cookie
+=
random
.
choice
(
alnum
)
xcookie
=
"x-cookie"
+
random
.
choice
(
alnum
)
d
[
xcookie
]
=
cookie
# shufle extension dict randomly - to likely trigger different ordering on save
keyv
=
d
.
keys
()
random
.
shuffle
(
keyv
)
ext
=
{}
for
key
in
keyv
:
ext
[
key
]
=
d
[
key
]
return
ext
def
main
():
def
main
():
logging
.
basicConfig
()
logging
.
basicConfig
()
...
@@ -90,15 +114,28 @@ def main():
...
@@ -90,15 +114,28 @@ def main():
obj
.
value
=
"%s%i.%i"
%
(
name
,
i
,
j
)
obj
.
value
=
"%s%i.%i"
%
(
name
,
i
,
j
)
commit
(
u"user%i.%i"
%
(
i
,
j
),
u"step %i.%i"
%
(
i
,
j
),
{
"x-generator"
:
"zodb/py2 (%s)"
%
name
}
)
commit
(
u"user%i.%i"
%
(
i
,
j
),
u"step %i.%i"
%
(
i
,
j
),
ext
(
name
)
)
# undo a transaction one step before a latest one a couple of times
# undo a transaction one step before a latest one a couple of times
for
j
in
range
(
2
):
for
j
in
range
(
2
):
ul
=
db
.
undoLog
(
1
,
2
)[
0
]
# XXX undoLog, despite what its interface says:
# https://github.com/zopefoundation/ZODB/blob/2490ae09/src/ZODB/interfaces.py#L472
# just returns log of all transactions in specified range:
# https://github.com/zopefoundation/ZODB/blob/2490ae09/src/ZODB/FileStorage/FileStorage.py#L1008
# https://github.com/zopefoundation/ZODB/blob/2490ae09/src/ZODB/FileStorage/FileStorage.py#L2103
# so we retry undoing next log's txn on conflict.
for
ul
in
db
.
undoLog
(
1
,
20
):
print
j
,
ul
try
:
db
.
undo
(
ul
[
"id"
])
db
.
undo
(
ul
[
"id"
])
commit
(
u"root%i.%i
\
n
Your
\
n
Magesty "
%
(
i
,
j
),
commit
(
u"root%i.%i
\
n
Your
\
n
Magesty "
%
(
i
,
j
),
u"undo %i.%i
\
n
more detailed description
\
n
\
n
zzz ..."
%
(
i
,
j
)
+
"
\
t
"
*
(
i
+
j
),
u"undo %i.%i
\
n
more detailed description
\
n
\
n
zzz ..."
%
(
i
,
j
)
+
"
\
t
"
*
(
i
+
j
),
{
"x-generator"
:
"zodb/py2 (undo %s)"
%
ul
[
"id"
]})
ext
(
"undo %s"
%
ul
[
"id"
]))
except
UndoError
:
transaction
.
abort
()
continue
break
# delete an object
# delete an object
name
=
random
.
choice
(
root
.
keys
())
name
=
random
.
choice
(
root
.
keys
())
...
@@ -107,11 +144,16 @@ def main():
...
@@ -107,11 +144,16 @@ def main():
# NOTE user/ext are kept empty on purpose - to also test this case
# NOTE user/ext are kept empty on purpose - to also test this case
commit
(
u""
,
u"predelete %s"
%
unpack64
(
obj
.
_p_oid
),
{})
commit
(
u""
,
u"predelete %s"
%
unpack64
(
obj
.
_p_oid
),
{})
# XXX obj in db could be changed by above undo, but ZODB does not automatically
# propagate undo changes to live objects - so obj._p_serial can be stale.
# Get serial via history.
obj_tid_lastchange
=
db
.
history
(
obj
.
_p_oid
)[
0
][
'tid'
]
txn
=
precommit
(
u"root%i
\
n
Your
\
n
Royal
\
n
Magesty "
%
i
,
txn
=
precommit
(
u"root%i
\
n
Your
\
n
Royal
\
n
Magesty "
%
i
,
u"delete %i
\
n
alpha beta gamma
\
n
\
n
qqq ..."
%
i
,
u"delete %i
\
n
alpha beta gamma
\
n
\
n
qqq ..."
%
i
,
{
"x-generator"
:
"zodb/py2 (delete %s)"
%
unpack64
(
obj
.
_p_oid
)}
)
ext
(
"delete %s"
%
unpack64
(
obj
.
_p_oid
))
)
stor
.
tpc_begin
(
txn
)
stor
.
tpc_begin
(
txn
)
stor
.
deleteObject
(
obj
.
_p_oid
,
obj
.
_p_serial
,
txn
)
stor
.
deleteObject
(
obj
.
_p_oid
,
obj
_tid_lastchange
,
txn
)
stor
.
tpc_vote
(
txn
)
stor
.
tpc_vote
(
txn
)
# TODO different txn status vvv
# TODO different txn status vvv
# XXX vvv it does the thing, but py fs iterator treats this txn as EOF
# XXX vvv it does the thing, but py fs iterator treats this txn as EOF
...
...
t/neo/storage/fs1/testdata/1.fs
View file @
0526cca3
No preview for this file type
t/neo/storage/fs1/testdata/1.fs.index
View file @
0526cca3
No preview for this file type
t/neo/storage/fs1/testdata_expect_test.go
View file @
0526cca3
This diff is collapsed.
Click to expand it.
t/neo/zodb/cmd/zodbdump/testdata/1.zdump.ok
View file @
0526cca3
No preview for this file type
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