Commit 14b40012 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 91592050
......@@ -498,14 +498,15 @@ class tFile:
dataok += b'\0'*(t.blksize - len(dataok)) # tailing zeros
assert blk < t._sizeinblk()
cached = f.cached()[blk]
cached = t.cached()[blk]
shouldPin = False # whether at least one wlink should receive a pin
# watches must be notified if access goes to @head/file; not if to @rev/file. XXX text
wpin = {} # tWatchLink -> (zf, pinok)
for wlink in t.tdb._wlinks:
pinok = {}
if t.at is None: # @head/...
wat = wlink._watching.get(zf)
wat = wlink._watching.get(t.zf)
if wat is not None and wat < blkrev:
if cached == 1:
# XXX assert blk already pinned on that watch
......@@ -513,17 +514,18 @@ class tFile:
else:
# XXX and watch not already pinned on the watch
pinok = {blk: t.tdb._blkRev(t.zf, blk, wat)}
shouldPin = True
wpin[wlink] = (t.zf, pinok)
if pinokByWLink is not None:
assert wpin == pinokByWLink, "computed vs explicit pinokByWLink"
pinokByWLink = wpin
blkview = f.blk(blk)
assert f.cached()[blk] == cached
blkview = t.blk(blk)
assert t.cached()[blk] == cached
def _(ctx, ev):
assert f.cached()[blk] == cached
assert t.cached()[blk] == cached
ev.append('read pre')
# access data with released GIL so that the thread that reads data from
......@@ -552,9 +554,13 @@ class tFile:
assert ev[0] == 'read pre'
assert ev[-1] == 'read ' + dataok[0]
ev = ev[1:-1]
# XXX ev == 'pin rx', 'pin ack pre' ....
if not shouldPin:
assert ev == []
else:
assert 'pin rx' in ev
assert 'pin ack pre' in ev
assert f.cached()[blk] > 0
assert t.cached()[blk] > 0
# XXX assert individually for every block's page? (easier debugging?)
assert blkview == dataok, ("#blk: %d" % blk)
......@@ -1143,7 +1149,7 @@ def test_wcfs():
# XXX 5, {5: ø}
# XXX 0, {0, at3} after δbtree works
"""
"""
blk = 2
pinok = {2: at3} # XXX at3 -> at <= wl.at for zf
......@@ -1180,7 +1186,7 @@ def test_wcfs():
assert f.cached()[blk] > 0
f.assertBlk(blk, '4c')
assert f.cached()[blk] == 1
"""
"""
wl.close()
......
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