Commit a5649f69 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 754c3f5a
...@@ -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)
......
...@@ -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 = db1.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 = db1.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 = db2.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
......
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