Commit 416e9ccf authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent f248b5a9
......@@ -53,20 +53,58 @@ def main():
def C1(ctx, N):
# XXX
pass
def c1():
transaction.begin()
zconn = db1.open()
root = zconn.root()
obj1 = root['obj1']
obj2 = root['obj2']
# obj1 - reload it from zstor
# obj2 - get it from zconn cache
for i in range(10*N):
obj1._p_invalidate()
# both objects must have the same values
i1 = obj1.i
i2 = obj2.i
if i1 != i2:
raise AssertionError("C1: obj1.i (%d) != obj2.i (%d)" % (i1, i2))
transaction.abort()
zconn.close()
for i in range(N):
print('C1.%d' % i)
c1()
def C2(ctx, N):
# XXX
pass
def c2():
transaction.begin()
zconn = db2.open()
root = zconn.root()
obj1 = root['obj1']
obj2 = root['obj2']
obj1.i += 1
obj2.i += 1
assert obj1.i == obj2.i
transaction.commit()
zconn.close()
for i in range(N):
print('C2.%d' % i)
c2()
init()
N = 1000
N = 100
wg = sync.WorkGroup(context.background())
wg.go(C1, N)
wg.go(C2, N)
......
......@@ -150,9 +150,9 @@ def main():
i1 = obj1.i
i2 = obj2.i
if i1 != i2:
raise AssertionError("t1: obj1.i (%d) != obj2.i (%d)" % (i1, i2))
raise AssertionError("T1: obj1.i (%d) != obj2.i (%d)" % (i1, i2))
transaction.commit()
transaction.abort() # we did not changed anything; also fails with commit
zconn.close()
for i in range(N):
......
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