Commit 44e100be authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 6206ed68
...@@ -1206,12 +1206,12 @@ def test_wcfs(): ...@@ -1206,12 +1206,12 @@ def test_wcfs():
f1.assertData (['','','c1']) # XXX + mtime=at1? f1.assertData (['','','c1']) # XXX + mtime=at1?
# >>> (@at3) commit again without changing zf size XXX write about b cache inval # >>> (@at3) commit again without changing zf size
f2 = t.open(zf, at=at2) f2 = t.open(zf, at=at2)
t.change(zf, {2: 'c3'}) # FIXME + a3 after δbtree works (hole -> zblk) t.change(zf, {2: 'c3'}) # FIXME + a3 after δbtree works (hole -> zblk)
at3 = t.commit() at3 = t.commit()
f.assertCache([1,1,0,1]) # FIXME a must be invalidated (see a3 ^^^) f.assertCache([1,1,0,1])
# f @head is opened again -> cache must not be lost # f @head is opened again -> cache must not be lost
f_ = t.open(zf) f_ = t.open(zf)
...@@ -1263,7 +1263,7 @@ def test_wcfs(): ...@@ -1263,7 +1263,7 @@ def test_wcfs():
wg.go(_) wg.go(_)
wg.wait() wg.wait()
wl.close() wl.close()
# NOTE if wcfs.go does not fully cleanup this canceled watch and leave it # NOTE if wcfs.go does not fully cleanup this canceled watch and leaves it
# in half-working state, it will break on further commit, as pin to the # in half-working state, it will break on further commit, as pin to the
# watch won't be handled. # watch won't be handled.
# TODO -> add explicit check for ^^^ if/when moved to separate test. # TODO -> add explicit check for ^^^ if/when moved to separate test.
...@@ -1300,6 +1300,7 @@ def test_wcfs(): ...@@ -1300,6 +1300,7 @@ def test_wcfs():
wl.watch(zf, at2, {2: at2, 3: None}) # at1 -> at2 wl.watch(zf, at2, {2: at2, 3: None}) # at1 -> at2
wl.watch(zf, at3, {2: None}) # at2 -> at3 (current head) wl.watch(zf, at3, {2: None}) # at2 -> at3 (current head)
# XXX + .watch in presence !accessed & changed [blk] # XXX + .watch in presence !accessed & changed [blk]
# XXX move f4 commit here?
wl.close() wl.close()
# all valid watch setup/update requests going at_i -> at_j -> ... with automatic pinok # all valid watch setup/update requests going at_i -> at_j -> ... with automatic pinok
...@@ -1320,7 +1321,7 @@ def test_wcfs(): ...@@ -1320,7 +1321,7 @@ def test_wcfs():
# watched + commit -> read -> receive pin messages. # watched + commit -> read -> receive pin messages.
# read vs pin ordering is checked by assertBlk. # read vs pin ordering is checked by assertBlk.
# #
# 5(f) is kept not accessed to check later how wcfs.go handles δFtail # f(5) is kept not accessed to check later how wcfs.go handles δFtail
# rebuild after it sees not yet accessed ZBlk that has change history. # rebuild after it sees not yet accessed ZBlk that has change history.
wl3 = t.openwatch(); w3 = wl3.watch(zf, at3); assert at3 == t.head wl3 = t.openwatch(); w3 = wl3.watch(zf, at3); assert at3 == t.head
assert w3.at == at3 assert w3.at == at3
...@@ -1341,6 +1342,7 @@ def test_wcfs(): ...@@ -1341,6 +1342,7 @@ def test_wcfs():
assert w2.pinned == pinw2 assert w2.pinned == pinw2
f.assertCache([1,1,1,1]) f.assertCache([1,1,1,1])
# XXX move f4 commit ^^^ (where watch with explicit pinok is tested)
t.change(zf, { 2: 'c4', 5: 'f4', 6: 'g4'}) # FIXME + b4 after δbtree works + update vvv t.change(zf, { 2: 'c4', 5: 'f4', 6: 'g4'}) # FIXME + b4 after δbtree works + update vvv
at4 = t.commit() at4 = t.commit()
f.assertCache([1,1,0,1,0,0,0]) f.assertCache([1,1,0,1,0,0,0])
...@@ -1361,7 +1363,7 @@ def test_wcfs(): ...@@ -1361,7 +1363,7 @@ def test_wcfs():
f.assertBlk(4, '', {wl3: {}, wl3_: {}, wl2: {}}) f.assertBlk(4, '', {wl3: {}, wl3_: {}, wl2: {}})
w_assertPin( {2:at3}, {2:at3}, {2:at2}) w_assertPin( {2:at3}, {2:at3}, {2:at2})
# 5(f) is kept unaccessed (see ^^^) # f(5) is kept unaccessed (see ^^^)
assert f.cached()[5] == 0 assert f.cached()[5] == 0
# f.assertBlk(5, 'f4', {wl3: {5:at0}, wl3_: {5:at0}, wl2: {5:at0}}) # XXX at0->ø? # f.assertBlk(5, 'f4', {wl3: {5:at0}, wl3_: {5:at0}, wl2: {5:at0}}) # XXX at0->ø?
# w_assertPin( {2:at3, 5:at0}, {2:at3, 5:at0}, {2:at2, 5:at0}) # w_assertPin( {2:at3, 5:at0}, {2:at3, 5:at0}, {2:at2, 5:at0})
...@@ -1370,10 +1372,10 @@ def test_wcfs(): ...@@ -1370,10 +1372,10 @@ def test_wcfs():
w_assertPin( {2:at3, 6:at0}, {2:at3, 6:at0}, {2:at2, 6:at0}) w_assertPin( {2:at3, 6:at0}, {2:at3, 6:at0}, {2:at2, 6:at0})
# commit again: # commit again:
# - 2(c) is already pinned -> wl3 not notified # - c(2) is already pinned -> wl3 not notified
# - watch stopped (wl3_) -> watch no longer notified # - watch stopped (wl3_) -> watch no longer notified
# - wlink closed (wl2) -> watch no longer notified # - wlink closed (wl2) -> watch no longer notified
# - 5(f) is still kept unaccessed (see ^^^) # - f(5) is still kept unaccessed (see ^^^)
f.assertCache([1,1,1,1,1,0,1]) f.assertCache([1,1,1,1,1,0,1])
t.change(zf, {2: 'c5', 3: 'd5', 5: 'f5'}) t.change(zf, {2: 'c5', 3: 'd5', 5: 'f5'})
at5 = t.commit() at5 = t.commit()
...@@ -1392,16 +1394,16 @@ def test_wcfs(): ...@@ -1392,16 +1394,16 @@ def test_wcfs():
f.assertBlk(1, '', {wl3: {}, wl3_: {}}) f.assertBlk(1, '', {wl3: {}, wl3_: {}})
w_assertPin( {2:at3, 6:at0}) w_assertPin( {2:at3, 6:at0})
f.assertBlk(2, 'c5', {wl3: {}, wl3_: {}}) # 2(c) already pinned on wl3 f.assertBlk(2, 'c5', {wl3: {}, wl3_: {}}) # c(2) already pinned on wl3
w_assertPin( {2:at3, 6:at0}) w_assertPin( {2:at3, 6:at0})
f.assertBlk(3, 'd5', {wl3: {3:at2}, wl3_: {}}) # 3(d) was not pinned on wl3; wl3_ not notified f.assertBlk(3, 'd5', {wl3: {3:at2}, wl3_: {}}) # d(3) was not pinned on wl3; wl3_ not notified
w_assertPin( {2:at3, 3:at2, 6:at0}) w_assertPin( {2:at3, 3:at2, 6:at0})
f.assertBlk(4, '', {wl3: {}, wl3_: {}}) f.assertBlk(4, '', {wl3: {}, wl3_: {}})
w_assertPin( {2:at3, 3:at2, 6:at0}) w_assertPin( {2:at3, 3:at2, 6:at0})
# 5(f) is kept still unaccessed (see ^^^) # f(5) is kept still unaccessed (see ^^^)
assert f.cached()[5] == 0 assert f.cached()[5] == 0
# f.assertBlk(5, 'f4', {wl3: {}, wl3_: {}}) # f.assertBlk(5, 'f4', {wl3: {}, wl3_: {}})
# w_assertPin( {2:at3, 3:at2, 5:at0}) # w_assertPin( {2:at3, 3:at2, 5:at0})
...@@ -1412,16 +1414,20 @@ def test_wcfs(): ...@@ -1412,16 +1414,20 @@ def test_wcfs():
# advance watch - receives new pins/unpins to @head. # advance watch - receives new pins/unpins to @head.
# this is also tested ^^^ in `at_i -> at_j -> ...` watch setup/adjust. # this is also tested ^^^ in `at_i -> at_j -> ...` watch setup/adjust.
# NOTE 5(f) is not affected because it was not pinned previously. # NOTE f(5) is not affected because it was not pinned previously.
wl3.watch(zf, at4, {2:at4, 6:None}) # at3 -> at4 wl3.watch(zf, at4, {2:at4, 6:None}) # at3 -> at4
w_assertPin( {2:at4, 3:at2}) w_assertPin( {2:at4, 3:at2})
return # access f(5) -> wl3 should be correctly pinned
assert f.cached() == [1,1,1,1,1,0,1] # f(5) was not yet accessed
f.assertBlk(5, 'f5', {wl3: {5:at4}, wl3_: {}})
w_assertPin( {2:at4, 3:at2, 5:at4})
# XXX access 5(f) -> wl3 should be correctly pinned <- !!! return
# advance watch again
wl3.watch(zf, at5, {2:None, 3:None}) # at4 -> at5 wl3.watch(zf, at5, {2:None, 3:None}) # at4 -> at5
w_assertPin( {}) w_assertPin( {}) # XXX + 5
wl3.close() wl3.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