Commit d64280c6 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 494dc22c
...@@ -1743,52 +1743,51 @@ def test_wcfspy_virtmem(): ...@@ -1743,52 +1743,51 @@ def test_wcfspy_virtmem():
wconn = t.wc.connect(at1) wconn = t.wc.connect(at1)
defer(wconn.close) defer(wconn.close)
wf = wconn.open(zf._p_oid) fh = wconn.open(zf._p_oid)
# XXX defer(wf.close) # XXX defer(fh.close)
# create mmap with 1 block beyond file size # create mmap with 1 block beyond file size
m1 = wf.mmap(2, 3) m1 = fh.mmap(2, 3)
defer(m1.unmap) defer(m1.unmap)
assert m1.blk_start == 2 assert m1.blk_start == 2
assert m1.blk_stop == 5 assert m1.blk_stop == 5
assert len(m1.mem) == 3*zf.blksize assert len(m1.mem) == 3*zf.blksize
f = m1.file
tm1 = tMapping(m1) tm1 = tMapping(m1)
#assertCache(m1, [0,0,0]) #assertCache(m1, [0,0,0])
assert f.pinned == {} assert fh.pinned == {}
# verify initial data reads # verify initial data reads
tm1.assertBlk(2, 'c1') tm1.assertBlk(2, 'c1')
assert f.pinned == {2:at1} assert fh.pinned == {2:at1}
tm1.assertBlk(3, 'd1') tm1.assertBlk(3, 'd1')
assert f.pinned == {2:at1} assert fh.pinned == {2:at1}
tm1.assertBlk(4, '') tm1.assertBlk(4, '')
assert f.pinned == {2:at1} assert fh.pinned == {2:at1}
# commit with growing file size -> verify data read as the same, #3 pinned. # commit with growing file size -> verify data read as the same, #3 pinned.
# (#4 is not yet pinned because it was not accessed) # (#4 is not yet pinned because it was not accessed)
at3 = t.commit(zf, {3:'d3', 4:'e3'}) at3 = t.commit(zf, {3:'d3', 4:'e3'})
assert f.pinned == {2:at1} assert fh.pinned == {2:at1}
tm1.assertBlk(2, 'c1') tm1.assertBlk(2, 'c1')
assert f.pinned == {2:at1} assert fh.pinned == {2:at1}
tm1.assertBlk(3, 'd1') tm1.assertBlk(3, 'd1')
assert f.pinned == {2:at1, 3:at1} assert fh.pinned == {2:at1, 3:at1}
tm1.assertBlk(4, '') tm1.assertBlk(4, '')
assert f.pinned == {2:at1, 3:at1} assert fh.pinned == {2:at1, 3:at1}
# resync at1 -> at2: #2 must unpin to @head; #4 must stay as zero # resync at1 -> at2: #2 must unpin to @head; #4 must stay as zero
wconn.resync(at2) wconn.resync(at2)
assert f.pinned == {3:at1} assert fh.pinned == {3:at1}
tm1.assertBlk(2, 'c2') tm1.assertBlk(2, 'c2')
tm1.assertBlk(3, 'd1') tm1.assertBlk(3, 'd1')
tm1.assertBlk(4, '') tm1.assertBlk(4, '')
# resync at2 -> at3: #3 must unpin to @head; #4 - start to read with data # resync at2 -> at3: #3 must unpin to @head; #4 - start to read with data
wconn.resync(at3) wconn.resync(at3)
assert f.pinned == {} assert fh.pinned == {}
tm1.assertBlk(2, 'c2') tm1.assertBlk(2, 'c2')
tm1.assertBlk(3, 'd3') tm1.assertBlk(3, 'd3')
tm1.assertBlk(4, 'e3') tm1.assertBlk(4, 'e3')
......
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