Commit 4e8c3489 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent cac15697
......@@ -533,6 +533,8 @@ func (root *Root) zwatcher(ctx context.Context) (err error) {
defer xerr.Contextf(&err, "zwatch") // XXX more in context?
// XXX unmount on error? -> always EIO?
log.Info("ZWatcher ...")
zwatchq := make(chan zodb.CommitEvent)
root.zstor.AddWatch(zwatchq)
defer root.zstor.DelWatch(zwatchq)
......@@ -541,11 +543,15 @@ func (root *Root) zwatcher(ctx context.Context) (err error) {
var ok bool
for {
log.Info(".")
select {
case <-ctx.Done():
log.Info("cancel")
return ctx.Err()
case zevent, ok = <-zwatchq:
log.Info("event")
if !ok {
return nil // closed XXX ok?
}
......@@ -557,6 +563,7 @@ func (root *Root) zwatcher(ctx context.Context) (err error) {
// zhandle1 handles 1 event from ZODB notification.
func (root *Root) zhandle1(zevent zodb.CommitEvent) {
log.Infof("zwatcher: handle: %s", zevent)
// while we are invalidating OS cache, make sure that nothing, that
// even reads /head/bigfile/*, is running (see 4.6).
root.head.zconnMu.Lock()
......@@ -1287,6 +1294,11 @@ func main() {
Node: newDefaultNode(),
})
// XXX place = ok?
// XXX ctx = ok?
// XXX wait for zwatcher shutdown.
go root.zwatcher(ctx)
// TODO handle autoexit
_ = autoexit
......
......@@ -168,6 +168,7 @@ def test_wcfs():
Z = _()
Z.tidv = []
def commit():
print 'commit'
last._p_changed = 1
transaction.commit()
tid = last._p_serial
......
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