Commit 150cf9a7 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 22769012
......@@ -1250,6 +1250,7 @@ func (f *BigFile) updateWatchers(ctx context.Context, blk int64, treepath []btre
blkrev, _ = f.LastBlkRev(ctx, blk, f.head.zconn.At())
blkrevRough = false
// XXX w.at could be only ↑ ? if not - locking is more complex
if blkrev <= w.at {
continue
}
......@@ -1370,6 +1371,7 @@ func (w *Watch) _pin(ctx context.Context, blk int64, rev zodb.Tid) (err error) {
// XXX locking?
// XXX simultaneous calls?
// XXX ignore vvv ? (w.at could be ↑ after precheck in read (XXX or setupBlk)
if !(rev == zodb.TidMax || rev <= w.at) {
panicf("f<%s>: wlink%d: pin #%d @%s: watch.at (%s) < rev",
foid, w.link.id, blk, rev, w.at)
......@@ -1426,6 +1428,7 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
defer head.zheadMu.RUnlock()
headAt := head.zconn.At()
// XXX δFtail locking? (or ForgetPast is called only with zheadMu.W ?)
if at != zodb.InvalidTid && at < bfdir.δFtail.Tail() {
return fmt.Errorf("too far away back from head/at (@%s); δt = %s",
headAt, headAt.Time().Sub(at.Time().Time))
......@@ -1501,6 +1504,7 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
//
// XXX locking
// XXX register only if watch was created anew, not updated?
w.at = at
f.watchTab[w] = struct{}{}
wlink.byfile[foid] = w
......@@ -1536,10 +1540,6 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
}
}
// XXX locking
// XXX do at the same time when registering ^^^, so that simultaneous READs see correct w.at
w.at = at
wg, ctx := errgroup.WithContext(ctx)
for blk, rev := range toPin {
blk := 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