Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
a5649f69
Commit
a5649f69
authored
Dec 11, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
754c3f5a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
31 deletions
+11
-31
zloadrace.py
zloadrace.py
+4
-3
zopenrace.py
zopenrace.py
+7
-28
No files found.
zloadrace.py
View file @
a5649f69
...
@@ -27,11 +27,12 @@ def main():
...
@@ -27,11 +27,12 @@ def main():
tdb
=
TestDB_ZEO
(
'<zeo>'
)
tdb
=
TestDB_ZEO
(
'<zeo>'
)
#tdb = TestDB_NEO('<neo>')
#tdb = TestDB_NEO('<neo>')
defer
(
tdb
.
teardown
)
tdb
.
setup
()
# XXX defer(tdb.teardown)
# two ZODB client storage connections to the same server
# two ZODB client storage connections to the same server
zstor1
=
tdb
.
getZODBStorage
()
;
defer
(
zstor1
.
close
)
zstor1
=
tdb
.
getZODBStorage
()
#
; defer(zstor1.close)
zstor2
=
tdb
.
getZODBStorage
()
;
defer
(
zstor2
.
close
)
zstor2
=
tdb
.
getZODBStorage
()
#
; defer(zstor2.close)
db1
=
DB
(
zstor1
)
db1
=
DB
(
zstor1
)
db2
=
DB
(
zstor2
)
db2
=
DB
(
zstor2
)
...
...
zopenrace.py
View file @
a5649f69
...
@@ -110,33 +110,14 @@ class PInt(Persistent):
...
@@ -110,33 +110,14 @@ class PInt(Persistent):
def
main
():
def
main
():
# for ZODB5: open vs invalidation race
zstor
=
MappingStorage
()
if
0
:
db
=
DB
(
zstor
)
zstor1
=
zstor2
=
MappingStorage
()
db1
=
db2
=
DB
(
zstor1
)
# for ZODB3/ZODB5: load vs invalidation race
if
1
:
from
wendelin.lib.testing
import
TestDB_ZEO
,
TestDB_NEO
tdb
=
TestDB_ZEO
(
'<zeo>'
)
#tdb = TestDB_NEO('<neo>')
tdb
.
setup
()
# XXX defer(tdb.teardown)
# two ZODB client storage connections to the same server
zstor1
=
tdb
.
getZODBStorage
()
# ; defer(zstor1.close)
zstor2
=
tdb
.
getZODBStorage
()
# ; defer(zstor2.close)
db1
=
DB
(
zstor1
)
db2
=
DB
(
zstor2
)
# init initializes the database with two integer objects - obj1/obj2 that are set to 0.
# init initializes the database with two integer objects - obj1/obj2 that are set to 0.
def
init
():
def
init
():
transaction
.
begin
()
transaction
.
begin
()
zconn
=
db
1
.
open
()
zconn
=
db
.
open
()
root
=
zconn
.
root
()
root
=
zconn
.
root
()
root
[
'obj1'
]
=
PInt
(
0
)
root
[
'obj1'
]
=
PInt
(
0
)
...
@@ -155,7 +136,7 @@ def main():
...
@@ -155,7 +136,7 @@ def main():
def
T1
(
N
):
def
T1
(
N
):
def
t1
():
def
t1
():
transaction
.
begin
()
transaction
.
begin
()
zconn
=
db
1
.
open
()
zconn
=
db
.
open
()
root
=
zconn
.
root
()
root
=
zconn
.
root
()
obj1
=
root
[
'obj1'
]
obj1
=
root
[
'obj1'
]
...
@@ -175,10 +156,8 @@ def main():
...
@@ -175,10 +156,8 @@ def main():
zconn
.
close
()
zconn
.
close
()
for
i
in
range
(
N
):
for
i
in
range
(
N
):
print
(
'T1.%d'
%
i
)
#
print('T1.%d' % i)
t1
()
t1
()
#import time
#time.sleep(1)
okv
[
0
]
=
True
okv
[
0
]
=
True
...
@@ -188,7 +167,7 @@ def main():
...
@@ -188,7 +167,7 @@ def main():
def
T2
(
N
):
def
T2
(
N
):
def
t2
():
def
t2
():
transaction
.
begin
()
transaction
.
begin
()
zconn
=
db
2
.
open
()
zconn
=
db
.
open
()
root
=
zconn
.
root
()
root
=
zconn
.
root
()
obj1
=
root
[
'obj1'
]
obj1
=
root
[
'obj1'
]
...
@@ -201,7 +180,7 @@ def main():
...
@@ -201,7 +180,7 @@ def main():
zconn
.
close
()
zconn
.
close
()
for
i
in
range
(
N
):
for
i
in
range
(
N
):
print
(
'T2.%d'
%
i
)
#
print('T2.%d' % i)
t2
()
t2
()
okv
[
1
]
=
True
okv
[
1
]
=
True
...
...
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