Commit f21771d3 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a7e3e8f6
...@@ -622,7 +622,7 @@ type Watch struct { ...@@ -622,7 +622,7 @@ type Watch struct {
link *WatchLink // link to client link *WatchLink // link to client
file *BigFile // XXX needed? file *BigFile // XXX needed?
mu sync.Mutex // XXX ok ? mu sync.Mutex // XXX split -> atMu(RW) + pinnedMu
at zodb.Tid // requested to be watched @at at zodb.Tid // requested to be watched @at
pinned map[int64]*blkPinState // {} blk -> {... rev} blocks that are already pinned to be ≤ at pinned map[int64]*blkPinState // {} blk -> {... rev} blocks that are already pinned to be ≤ at
} }
...@@ -1298,7 +1298,7 @@ func (w *Watch) _pin(ctx context.Context, blk int64, rev zodb.Tid) (err error) { ...@@ -1298,7 +1298,7 @@ func (w *Watch) _pin(ctx context.Context, blk int64, rev zodb.Tid) (err error) {
w.mu.Lock() w.mu.Lock()
// XXX ignore vvv ? (w.at could be ↑ after precheck in read (XXX or setupBlk) // XXX ignore vvv ? (w.at could be ↑ after precheck in read (XXX or setupWatch)
if wat := w.at; !(rev == zodb.TidMax || rev <= wat) { if wat := w.at; !(rev == zodb.TidMax || rev <= wat) {
w.mu.Unlock() w.mu.Unlock()
panicf("f<%s>: wlink%d: pin #%d @%s: watch.at (%s) < rev", panicf("f<%s>: wlink%d: pin #%d @%s: watch.at (%s) < rev",
...@@ -1383,7 +1383,7 @@ func (w *Watch) _pin(ctx context.Context, blk int64, rev zodb.Tid) (err error) { ...@@ -1383,7 +1383,7 @@ func (w *Watch) _pin(ctx context.Context, blk int64, rev zodb.Tid) (err error) {
// //
// XXX do we really need to use/propagate caller context here? ideally update // XXX do we really need to use/propagate caller context here? ideally update
// watchers should be synchronous, and in practice we just use 30s timeout. // watchers should be synchronous, and in practice we just use 30s timeout.
// Should a READ interrupt cause watch update failure? // Should a READ interrupt cause watch update failure? -> probably no
func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, treepath []btree.LONode, zblk zBlk, blkrevMax zodb.Tid) { func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, treepath []btree.LONode, zblk zBlk, blkrevMax zodb.Tid) {
// only head/ is being watched for // only head/ is being watched for
if f.head.rev != 0 { if f.head.rev != 0 {
...@@ -1418,7 +1418,7 @@ func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, treepath []btr ...@@ -1418,7 +1418,7 @@ func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, treepath []btr
// XXX locking (w) // XXX locking (w)
// the block is already covered by @w.at database view // the block is already covered by @w.at database view
if blkrev <= w.at { if blkrev <= w.at { // XXX locking
continue continue
} }
...@@ -1429,7 +1429,7 @@ func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, treepath []btr ...@@ -1429,7 +1429,7 @@ func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, treepath []btr
blkrevRough = false blkrevRough = false
// XXX w.at could be only ↑ ? if not - locking is more complex // XXX w.at could be only ↑ ? if not - locking is more complex
if blkrev <= w.at { if blkrev <= w.at { // XXX locking
continue continue
} }
} }
...@@ -1440,7 +1440,7 @@ func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, treepath []btr ...@@ -1440,7 +1440,7 @@ func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, treepath []btr
// and most of them would be on different w.at - cache of the file will // and most of them would be on different w.at - cache of the file will
// be lost. Via pinning to particular block revision, we make sure the // be lost. Via pinning to particular block revision, we make sure the
// revision to pin is the same on all clients, and so file cache is shared. // revision to pin is the same on all clients, and so file cache is shared.
pinrev, _ := w.file.LastBlkRev(ctx, blk, w.at) // XXX move into go? pinrev, _ := w.file.LastBlkRev(ctx, blk, w.at) // XXX locking (w), move into go?
wg.Go(func() error { wg.Go(func() error {
// XXX close watcher on any error // XXX close watcher on any error
......
...@@ -60,7 +60,7 @@ def setup_module(): ...@@ -60,7 +60,7 @@ def setup_module():
install_sigbus_trap() install_sigbus_trap()
# if wcfs.go is built with race detector and detects a race - make it fail # if wcfs.go is built with race detector and detects a race - make it fail
# current test loudly on the first wcfs.go race # current test loudly on the first wcfs.go race.
gorace = os.environ.get("GORACE", "") gorace = os.environ.get("GORACE", "")
if gorace != "": if gorace != "":
gorace += " " gorace += " "
......
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