Commit 5dfa6050 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 90f869ab
...@@ -539,7 +539,7 @@ type BigFile struct { ...@@ -539,7 +539,7 @@ type BigFile struct {
loading map[int64]*blkLoadState // #blk -> {... blkdata} loading map[int64]*blkLoadState // #blk -> {... blkdata}
// XXX mappings where client(s) requested isolation guarantee // XXX mappings where client(s) requested isolation guarantee
//mappings ... //mappings ... XXX -> watchers?
} }
// blkLoadState represents a ZBlk load state/result. // blkLoadState represents a ZBlk load state/result.
...@@ -614,7 +614,7 @@ func (root *Root) zwatcher(ctx context.Context) (err error) { ...@@ -614,7 +614,7 @@ func (root *Root) zwatcher(ctx context.Context) (err error) {
zwatchq := make(chan zodb.Event) zwatchq := make(chan zodb.Event)
at0 := root.zstor.AddWatch(zwatchq) // XXX -> to main thread to avoid race at0 := root.zstor.AddWatch(zwatchq) // XXX -> to main thread to avoid race
defer root.zstor.DelWatch(zwatchq) defer root.zstor.DelWatch(zwatchq)
_ = at0 // XXX _ = at0 // XXX XXX
var zevent zodb.Event var zevent zodb.Event
var ok bool var ok bool
...@@ -626,7 +626,6 @@ func (root *Root) zwatcher(ctx context.Context) (err error) { ...@@ -626,7 +626,6 @@ func (root *Root) zwatcher(ctx context.Context) (err error) {
traceZWatch("cancel") traceZWatch("cancel")
return ctx.Err() return ctx.Err()
// TODO handle errors from ZODB watch stream
case zevent, ok = <-zwatchq: case zevent, ok = <-zwatchq:
if !ok { if !ok {
traceZWatch("zwatchq closed") traceZWatch("zwatchq closed")
...@@ -686,6 +685,8 @@ retry: ...@@ -686,6 +685,8 @@ retry:
close(continueOSCacheUpload) close(continueOSCacheUpload)
}() }()
// head.zconnMu locked and not cache uploaders are running
zhead := head.zconn zhead := head.zconn
bfdir := head.bfdir bfdir := head.bfdir
...@@ -697,18 +698,18 @@ retry: ...@@ -697,18 +698,18 @@ retry:
toinvalidate := map[*BigFile]*fileInvalidate{} // {} file -> set(#blk), sizeChanged toinvalidate := map[*BigFile]*fileInvalidate{} // {} file -> set(#blk), sizeChanged
btreeChangev := []zodb.Oid{} // oids changing BTree|Bucket btreeChangev := []zodb.Oid{} // oids changing BTree|Bucket
fmt.Printf("\n\n\n") //fmt.Printf("\n\n\n")
// zδ = (tid↑, []oid) // zδ = (tid↑, []oid)
for _, oid := range .Changev { for _, oid := range .Changev {
// XXX zhead.Cache() lock/unlock + comment it is not really needed // XXX zhead.Cache() lock/unlock
obj := zhead.Cache().Get(oid) obj := zhead.Cache().Get(oid)
if obj == nil { if obj == nil {
fmt.Printf("%s: not in cache\n", oid) //fmt.Printf("%s: not in cache\n", oid)
continue // nothing to do - see invariant continue // nothing to do - see invariant
} }
fmt.Printf("%s: in cache (%s)\n", oid, typeOf(obj)) //fmt.Printf("%s: in cache (%s)\n", oid, typeOf(obj))
switch obj := obj.(type) { switch obj := obj.(type) {
default: default:
...@@ -759,9 +760,9 @@ retry: ...@@ -759,9 +760,9 @@ retry:
// find out which files need to be invalidated due to index change // find out which files need to be invalidated due to index change
// XXX no indexMu lock needed because head is Locked // XXX no indexMu lock needed because head is Locked
// XXX stub -> TODO full δbtree | update indexLooked itself // XXX stub -> TODO full δbtree | update indexLooked itself
fmt.Printf("\nbtreeChangev: %v\n", btreeChangev) //fmt.Printf("\nbtreeChangev: %v\n", btreeChangev)
xfiles := bfdir.indexLooked.Invalidates(btreeChangev) xfiles := bfdir.indexLooked.Invalidates(btreeChangev)
fmt.Printf("xfiles: %v\n", xfiles) //fmt.Printf("xfiles: %v\n", xfiles)
for xfile := range xfiles { for xfile := range xfiles {
file := xfile.(*BigFile) file := xfile.(*BigFile)
finv, ok := toinvalidate[file] finv, ok := toinvalidate[file]
...@@ -772,10 +773,10 @@ retry: ...@@ -772,10 +773,10 @@ retry:
finv.size = true finv.size = true
} }
fmt.Printf("\n\nzδhandle: toinvalidate (#%d):\n", len(toinvalidate)) //fmt.Printf("\n\nzδhandle: toinvalidate (#%d):\n", len(toinvalidate))
for file := range toinvalidate { //for file := range toinvalidate {
fmt.Printf("\t- %s\n", file.zfile.POid()) // fmt.Printf("\t- %s\n", file.zfile.POid())
} //}
wg, ctx := errgroup.WithContext(context.TODO()) wg, ctx := errgroup.WithContext(context.TODO())
for file, finv := range toinvalidate { for file, finv := range toinvalidate {
......
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