Commit edaf43c4 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 2c4cbbd5
......@@ -804,7 +804,7 @@ class _ZBigFileH(object):
#
# the reason we do it here, is that if we don't and Connection was not
# yet joined to transaction (i.e. no changes were made to Connection's
# objects), as storeblk() running inside commit will case changes to
# objects), as storeblk() running inside commit will cause changes to
# ZODB objects, zconn will want to join transaction, and that is
# currently forbidden.
#
......
......@@ -250,39 +250,57 @@ def test_zconn_at():
conn1 = db.open()
assert zconn_at(conn1) == at0
# open another simultaneous connection
conn2 = db.open()
assert zconn_at(conn2) == at0
# commit
root1 = conn1.root()
root1['z'] = 1
transaction.commit()
# after commit connection view is updated
# after commit conn1 view is updated; conn2 view stays @at0
zsync(stor)
at1 = stor.lastTransaction()
assert zconn_at(conn1) == at1
assert zconn_at(conn2) == at0
# reopen -> view @at1
# reopen conn1 -> view @at1
conn1.close()
with raises(POSException.ConnectionStateError):
zconn_at(conn1)
conn2 = db.open()
assert conn2 is conn1 # returned from DB pool
assert zconn_at(conn2) == at1
conn2.close()
assert zconn_at(conn2) == at0
conn1_ = db.open()
assert conn1_ is conn1 # returned from DB pool
assert zconn_at(conn1) == at1
assert zconn_at(conn2) == at0
conn1.close()
# commit empty transaction - view stays in sync with storage head
#
# TODO zconn_at after empty commit (with fs1 currently gives future tid,
# but db is not updated and wcfs client resync to that future tid hangs)
conn3 = db.open()
assert conn3 is conn2 # from DB pool
assert zconn_at(conn3) == at1
conn1_ = db.open()
assert conn1_ is conn2 # from DB pool
assert zconn_at(conn1) == at1
assert zconn_at(conn2) == at0
transaction.commit()
zsync(stor)
at1_ = stor.lastTransaction()
assert zconn_at(conn3) == at1_
assert zconn_at(conn1) == at1_
assert zconn_at(conn2) == at0
# reopen conn2 -> view upated to @at1_
conn2.close()
conn2_ = db.open()
assert conn2_ is conn2 # from DB pool
assert zconn_at(conn1) == at1_
assert zconn_at(conn2) == at1_
conn3.close()
conn1.close()
conn2.close()
# TODO commit -> know head -> open conn1,
......
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