Commit 1146656d authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 9d00163b
......@@ -202,7 +202,7 @@ class tDB:
tf.close()
for tw in t._wlinks.copy():
tw.close()
assert len(t._files) == 0
assert len(t._files) == 0
assert len(t._wlinks) == 0
t._wc_zheadfh.close()
t.wc.close()
......@@ -220,7 +220,7 @@ class tDB:
# change schedules zf to be changed according changeDelta at commit.
#
# changeDelta is {} blk -> data.
# changeDelta: {} blk -> data.
# data can be both bytes and unicode.
def change(t, zf, changeDelta):
assert isinstance(zf, ZBigFile)
......@@ -233,7 +233,7 @@ class tDB:
# commit commits transaction and makes sure wcfs is synchronized to it.
#
# It remembers/returns committed transaction ID.
# It updates .dFtail and returns committed transaction ID.
def commit(t):
# perform modifications scheduled by change.
# use !wcfs mode so that we prepare data independently of wcfs code paths.
......@@ -248,11 +248,10 @@ class tDB:
memcpy(vma, data)
dF.byfile[zf] = dfile
# NOTE there is no clean way to retrieve tid of just committed transaction
# we use last._p_serial as workaround.
# perform the commit. NOTE there is no clean way to retrieve tid of
# just committed transaction - we use last._p_serial as workaround.
t.root['_last'] = last = Persistent()
last._p_changed = 1
transaction.commit()
head = last._p_serial
......@@ -260,15 +259,15 @@ class tDB:
for dfile in dF.byfile.values():
dfile.rev = head
t.dFtail.append(dF)
assert t.head == head # self-check
print('\nM: commit -> %s' % t.hat(head))
for zf, zfDelta in t._changed.items():
print('M: f<%s>\t%s' % (h(zf._p_oid), sorted(zfDelta.keys())))
t._changed = {}
# synchronize wcfs to db
# synchronize wcfs to db, and we are done
t._wcsync()
return head
# _blkaccess marks head/zf[blk] accessed.
......@@ -1140,7 +1139,7 @@ def test_wcfs():
t.root['!file'] = nonfile = Persistent()
t.root['zfile'] = zf = ZBigFile(blksize)
at0 = t.commit()
at0 = t.commit()
# >>> lookup non-BigFile -> must be rejected
with raises(OSError) as exc:
......
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