Commit 3acc5bbf authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 30a8ea09
...@@ -120,7 +120,7 @@ def join(zurl, autostart=_default_autostart()): ...@@ -120,7 +120,7 @@ def join(zurl, autostart=_default_autostart()):
raise RuntimeError("wcfs: join %s: server not started" % zurl) raise RuntimeError("wcfs: join %s: server not started" % zurl)
# start wcfs with telling it to automatically exit when there is no client activity. # start wcfs with telling it to automatically exit when there is no client activity.
return _start(zurl, "-autoexit", '-d', '-alsologtostderr') return _start(zurl, "-autoexit", '-d', '-alsologtostderr', '-v=1')
# _start starts wcfs server for ZODB @ zurl. # _start starts wcfs server for ZODB @ zurl.
......
...@@ -527,13 +527,21 @@ func (cc *zodbCacheControl) WantEvict(obj zodb.IPersistent) bool { ...@@ -527,13 +527,21 @@ func (cc *zodbCacheControl) WantEvict(obj zodb.IPersistent) bool {
return false return false
} }
func traceWatch(format string, argv ...interface{}) {
if !log.V(1) { // XXX -> 2?
return
}
log.Infof("zwatcher: " + format, argv...)
}
// zwatcher watches for ZODB changes. // zwatcher watches for ZODB changes.
// see "4) when we receive an invalidation message from ZODB ..." // see "4) when we receive an invalidation message from ZODB ..."
func (root *Root) zwatcher(ctx context.Context) (err error) { func (root *Root) zwatcher(ctx context.Context) (err error) {
defer xerr.Contextf(&err, "zwatch") // XXX more in context? defer xerr.Contextf(&err, "zwatch") // XXX more in context?
// XXX unmount on error? -> always EIO? // XXX unmount on error? -> always EIO?
log.Info("ZWatcher ...") traceWatch(">>>")
zwatchq := make(chan zodb.CommitEvent) zwatchq := make(chan zodb.CommitEvent)
root.zstor.AddWatch(zwatchq) root.zstor.AddWatch(zwatchq)
...@@ -543,18 +551,19 @@ func (root *Root) zwatcher(ctx context.Context) (err error) { ...@@ -543,18 +551,19 @@ func (root *Root) zwatcher(ctx context.Context) (err error) {
var ok bool var ok bool
for { for {
log.Info("ZWatcher: select ...") traceWatch("select ...")
select { select {
case <-ctx.Done(): case <-ctx.Done():
log.Info("cancel") traceWatch("cancel")
return ctx.Err() return ctx.Err()
case zevent, ok = <-zwatchq: case zevent, ok = <-zwatchq:
log.Info("event", zevent, ok)
if !ok { if !ok {
traceWatch("zwatchq closed")
return nil // closed XXX ok? return nil // closed XXX ok?
} }
traceWatch("zevent: %s", zevent)
} }
root.zhandle1(zevent) root.zhandle1(zevent)
...@@ -563,7 +572,6 @@ func (root *Root) zwatcher(ctx context.Context) (err error) { ...@@ -563,7 +572,6 @@ func (root *Root) zwatcher(ctx context.Context) (err error) {
// zhandle1 handles 1 event from ZODB notification. // zhandle1 handles 1 event from ZODB notification.
func (root *Root) zhandle1(zevent zodb.CommitEvent) { func (root *Root) zhandle1(zevent zodb.CommitEvent) {
log.Infof("zwatcher: handle: %s", zevent)
// while we are invalidating OS cache, make sure that nothing, that // while we are invalidating OS cache, make sure that nothing, that
// even reads /head/bigfile/*, is running (see 4.6). // even reads /head/bigfile/*, is running (see 4.6).
root.head.zconnMu.Lock() root.head.zconnMu.Lock()
......
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