Commit 136a3313 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 125b2a0d
......@@ -1353,25 +1353,32 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
return fmt.Errorf("file not yet known or is not a ZBigFile")
}
headAt := head.zconn.At()
// XXX wait head.zconn.At() ≥ at
// XXX <~> f.δtail.Head() ≥ at (?)
if at < bfdir.δFtail.Tail() {
// XXX err += head.at?
return fmt.Errorf("at is too far away back from head/at")
return fmt.Errorf("at is too far away back from head/at (%s)", headAt)
}
// TODO register w to f here early, so that READs going in parallel to us
// preparing and processing initial pins, also sends pin for read
// blocks. If we don't we can miss to send pin for a freshly read which
// could have revision > w.at .
w = &Watch{
link: wlink,
file: f,
at: at,
pinned: make(SetI64),
}
toPin := map[int64]zodb.Tid{} // blk -> @rev
// XXX locking
// pin all tracked file blocks that were changed (at, head] range
fhead := tidmin(f.δtail.Head(), head.zconn.At())
fhead := tidmin(f.δtail.Head(), headAt)
for _, δfile := range f.δtail.SliceByRev(at, fhead) {
for _, blk := range δfile.Changev {
_, already := toPin[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