Commit 8e79538d authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 905b601f
......@@ -1106,6 +1106,7 @@ def _expectPin(twlink, ctx, zf, expect): # -> []tSrvReq
def test_wcfs():
t = tDB()
xdefer(t.close)
xdefer(t.dump_history)
t.root['!file'] = nonfile = Persistent()
t.root['zfile'] = zf = ZBigFile(blksize)
......@@ -1145,10 +1146,10 @@ def test_wcfs():
# >>> (@at3) commit again without changing zf size XXX write about b cache inval
f2 = t.open(zf, at=at2)
t.change(zf, {2: 'c3'}) # FIXME + 3b after δbtree works (hole -> zblk)
t.change(zf, {2: 'c3'}) # FIXME + a3 after δbtree works (hole -> zblk)
at3 = t.commit()
f.assertCache([1,1,0,1]) # FIXME b must be invalidated (see 3b ^^^)
f.assertCache([1,1,0,1]) # FIXME a must be invalidated (see a3 ^^^)
# f @head is opened again -> cache must not be lost
f_ = t.open(zf)
......@@ -1280,9 +1281,9 @@ def test_wcfs():
assert w2.pinned == pinw2
f.assertCache([1,1,1,1])
t.change(zf, { 2: 'c4', 5: 'f4'}) # FIXME + 4a after δbtree works & update everything vvv
t.change(zf, { 2: 'c4', 5: 'f4', 6: 'g4'}) # FIXME + b4 after δbtree works + update vvv
at4 = t.commit()
f.assertCache([1,1,0,1,0,0])
f.assertCache([1,1,0,1,0,0,0])
f.assertBlk(0, '', {wl3: {}, wl3_: {}, wl2: {}})
w_assertPin( {}, {}, {2:at2})
......@@ -1300,19 +1301,23 @@ def test_wcfs():
f.assertBlk(4, '', {wl3: {}, wl3_: {}, wl2: {}})
w_assertPin( {2:at3}, {2:at3}, {2:at2})
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})
# 5(f) is kept unaccessed to test how wcfs.go handles δFtail rebuild after
# it sees not yet accessed ZBlk that has change history.
# 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})
f.assertBlk(6, 'g4', {wl3: {6:at0}, wl3_: {6:at0}, wl2: {6:at0}}) # XXX at0->ø?
w_assertPin( {2:at3, 6:at0}, {2:at3, 6:at0}, {2:at2, 6:at0})
# commit again:
# - block is already pinned (#2) -> wl3 not notified
# - watch stopped (wl3_) -> watch no longer notified
# - wlink closed (wl2) -> watch no longer notified
f.assertCache([1,1,1,1,1,1])
t.change(zf, {2: 'c5', 3: 'd5'})
# XXX about 5
f.assertCache([1,1,1,1,1,0,1])
t.change(zf, {2: 'c5', 3: 'd5', 5: 'f5'})
at5 = t.commit()
f.assertCache([1,1,0,0,1,1])
t.dump_history()
f.assertCache([1,1,0,0,1,0,1])
wl3_.stop_watch(zf) # w3_ should not be notified
wl2.close() # wl2:* should not be notified
......@@ -1322,34 +1327,42 @@ def test_wcfs():
assert w2.pinned == {}; assert w2.at == z64 # wl2 closed
f.assertBlk(0, '', {wl3: {}, wl3_: {}}) # no change
w_assertPin( {2:at3, 5:at0})
w_assertPin( {2:at3, 6:at0})
f.assertBlk(1, '', {wl3: {}, wl3_: {}})
w_assertPin( {2:at3, 5:at0})
w_assertPin( {2:at3, 6:at0})
f.assertBlk(2, 'c5', {wl3: {}, wl3_: {}}) # blk2 already pinned on wl3
w_assertPin( {2:at3, 5:at0})
w_assertPin( {2:at3, 6:at0})
f.assertBlk(3, 'd5', {wl3: {3:at2}, wl3_: {}}) # wl3_ not notified
w_assertPin( {2:at3, 3:at2, 5:at0})
w_assertPin( {2:at3, 3:at2, 6:at0})
f.assertBlk(4, '', {wl3: {}, wl3_: {}})
w_assertPin( {2:at3, 3:at2, 5:at0})
w_assertPin( {2:at3, 3:at2, 6:at0})
# 5(f) is kept still unaccessed
# f.assertBlk(5, 'f4', {wl3: {}, wl3_: {}})
# w_assertPin( {2:at3, 3:at2, 5:at0})
f.assertBlk(5, 'f4', {wl3: {}, wl3_: {}})
w_assertPin( {2:at3, 3:at2, 5:at0})
f.assertBlk(6, 'g4', {wl3: {6:at0}, wl3_: {}})
w_assertPin( {2:at3, 6:at0})
return
# advance watch - receives new pins/unpins to @head.
# this is also tested ^^^ in `at_i -> at_j -> ...` watch setup/adjust.
wl3.watch(zf, at4, {2:at4, 5:None}) # at3 -> at4
w_assertPin( {2:at4, 3:at2})
# XXX access 5(f) -> wl3 should be correctly pinned <- !!!
wl3.watch(zf, at5, {2:None, 3:None}) # at4 -> at5
w_assertPin( {})
wl3.close()
# XXX access to block not previously accessed but invalidated in ZODB
# XXX access to block not previously accessed but invalidated in ZODB <- !!!
# XXX watch with @at > head - must wait for head to become >= at
......
......@@ -46,7 +46,7 @@ import (
//
// ΔFtail provides the following operations:
//
// .Track(file, blkTreePath) - add file and block reached via BTree path to tracked set.
// .Track(file, blk, path, zblk) - add file and block reached via BTree path to tracked set.
//
// .Update(δZ) -> δF - update files δ tail given raw ZODB changes
// .ForgetPast(revCut) - forget changes past revCut
......@@ -97,7 +97,7 @@ type ΔFile struct {
type zblkInΔFtail struct {
mu sync.Mutex // used only for binding to support multiple loaders
// with which files/blocks this ZBlk is associated.
// with which files/blocks this ZBlk is associated. XXX as of @head state?
infile map[*BigFile]SetI64 // {} file -> set(#blk)
}
......
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