Commit 153e02e6 authored by Kirill Smelkov's avatar Kirill Smelkov

X test_wcfs_watch_setup and test_wcfs_watch_setup_ahead work again

parent cc216b8c
...@@ -615,6 +615,9 @@ type BigFile struct { ...@@ -615,6 +615,9 @@ type BigFile struct {
// //go:generate ./gen-δtail I64 int64 zδtail_i64.go // //go:generate ./gen-δtail I64 int64 zδtail_i64.go
// δtail *ΔTailI64 // [](rev↑, []#blk) // δtail *ΔTailI64 // [](rev↑, []#blk)
// blocks that were ever read-accessed (head/ only) XXX locking by bfdir.δFmu ?
accessed SetI64
// inflight loadings of ZBigFile from ZODB. // inflight loadings of ZBigFile from ZODB.
// successful load results are kept here until blkdata is put into OS pagecache. // successful load results are kept here until blkdata is put into OS pagecache.
// //
...@@ -1349,7 +1352,7 @@ retry: ...@@ -1349,7 +1352,7 @@ retry:
// //
// (see "7.2) for all registered client@at watchers ...") // (see "7.2) for all registered client@at watchers ...")
const _traceIso = true const _traceIso = false
func traceIso(format string, argv ...interface{}) { func traceIso(format string, argv ...interface{}) {
if !_traceIso { if !_traceIso {
return return
...@@ -1479,6 +1482,7 @@ func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, treepath []btr ...@@ -1479,6 +1482,7 @@ func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, treepath []btr
δFtail := bfdir.δFtail δFtail := bfdir.δFtail
bfdir.δFmu.Lock() // XXX locking correct? XXX -> better push down? bfdir.δFmu.Lock() // XXX locking correct? XXX -> better push down?
δFtail.Track(f, blk, treepath, zblk) // XXX pass in zblk.rev here? δFtail.Track(f, blk, treepath, zblk) // XXX pass in zblk.rev here?
f.accessed.Add(blk)
bfdir.δFmu.Unlock() bfdir.δFmu.Unlock()
// make sure that file[blk] on clients side stays as of @w.at state. // make sure that file[blk] on clients side stays as of @w.at state.
...@@ -1680,6 +1684,14 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T ...@@ -1680,6 +1684,14 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
if already { if already {
continue continue
} }
// blk might be in δFtail because it is adjacent in
// ZBigFile.blktab to another blk that was explicitly
// tracked. However wcfs tests expect that only blocks
// that were previously explicitly accessed are
// included into watch setup pins.
if !f.accessed.Has(blk) {
continue
}
toPin[blk], _ = δFtail.LastBlkRev(ctx, f, blk, at) // XXX err toPin[blk], _ = δFtail.LastBlkRev(ctx, f, blk, at) // XXX err
} }
...@@ -2170,6 +2182,7 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er ...@@ -2170,6 +2182,7 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
// FIXME: scan zfile.blktab - so that we can detect all btree changes // FIXME: scan zfile.blktab - so that we can detect all btree changes
// see "XXX building δFtail lazily ..." in notes.txt // see "XXX building δFtail lazily ..." in notes.txt
f.accessed = make(SetI64)
f.watchTab = make(map[*Watch]struct{}) f.watchTab = make(map[*Watch]struct{})
} }
......
...@@ -1019,7 +1019,7 @@ def _blkRevAt(t, zf, blk, at): # -> rev ...@@ -1019,7 +1019,7 @@ def _blkRevAt(t, zf, blk, at): # -> rev
return rev return rev
# _pinnedAt returns which blocks needs to be pinned for zf@at compared to zf@head # _pinnedAt returns which blocks need to be pinned for zf@at compared to zf@head
# according to wcfs isolation protocol. # according to wcfs isolation protocol.
# #
# Criteria for when blk must be pinned as of @at view: # Criteria for when blk must be pinned as of @at view:
...@@ -1141,7 +1141,6 @@ def test_wcfs_basic(): ...@@ -1141,7 +1141,6 @@ def test_wcfs_basic():
# verify how wcfs processes ZODB invalidations when hole becomes a block with data. # verify how wcfs processes ZODB invalidations when hole becomes a block with data.
# TODO merge into test_wcfs_basic & watch tests after δbtree is done
@func @func
def test_wcfs_basic_hole2zblk(): def test_wcfs_basic_hole2zblk():
t = tDB(); zf = t.zfile t = tDB(); zf = t.zfile
......
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