Commit 7c96cf5a authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent f58945b5
......@@ -1389,6 +1389,7 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
bfdir := head.bfdir
// XXX locking
// XXX head.zconnMu.RLock() + defer unlock (see vvv for unpin vs pin and locked head)
// XXX if watch was already established - we need to update it
w := wlink.byfile[foid]
......@@ -1442,7 +1443,7 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
// block which could have revision > w.at: XXX test
//
// 1 3 2 4
// -----.----x---o----x---x------.----------
// -----.----x---o----x---x------]----------
// ↑ ↑
// w.at head
//
......@@ -1454,6 +1455,22 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
// f.watches; if w ∉ f.watches at that moment, w will miss to receive
// pin for #3.
//
// NOTE for `unpin blk` head we can be sure there won't be simultaneous
// `pin blk` request, because:
//
// - unpin means blk was previously pinned,
// - blk was pinned means it is tracked by δFtail,
// - if blk is tracked and δFtail says there is no δblk ∈ (at, head],
// there is indeed no blk change in that region,
// - which means that δblk with rev > w.at might be only > head,
// - but such δblk are processed with zhead wlocked and we keep zhead
// rlocked during pin setup. XXX rlock zhead
//
// δ δ
// ----x----.------------]----x----
// ↑ ↑
// w.at head
//
// XXX locking
// XXX register only if watch was created anew, not updated?
f.watches[w] = struct{}{}
......
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