Commit d0d95b64 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent db2d5e41
...@@ -242,6 +242,7 @@ func (δBtail *ΔBtail) Track(key Key, nodePath []Node) error { // XXX Tree|Buck ...@@ -242,6 +242,7 @@ func (δBtail *ΔBtail) Track(key Key, nodePath []Node) error { // XXX Tree|Buck
pathv := []string{} pathv := []string{}
for _, node := range nodePath { pathv = append(pathv, vnode(node)) } for _, node := range nodePath { pathv = append(pathv, vnode(node)) }
tracefΔBtail("\nTrack [%v] %s\n", key, strings.Join(pathv, " -> ")) tracefΔBtail("\nTrack [%v] %s\n", key, strings.Join(pathv, " -> "))
tracefΔBtail("trackSet: %s\n", δBtail.trackSet) // XXX locking
return δBtail.track(key, path) return δBtail.track(key, path)
} }
...@@ -291,6 +292,8 @@ func (δBtail *ΔBtail) rebuildAll() (err error) { ...@@ -291,6 +292,8 @@ func (δBtail *ΔBtail) rebuildAll() (err error) {
trackNewRoots := δBtail.trackNewRoots trackNewRoots := δBtail.trackNewRoots
tracefΔBtail("\nRebuildAll @%s..@%s trackNewRoots: %s\n", δBtail.Tail(), δBtail.Head(), trackNewRoots)
for root := range trackNewRoots { for root := range trackNewRoots {
δTtail := δBtail.vδTbyRoot[root] // must be there δTtail := δBtail.vδTbyRoot[root] // must be there
δtrackSet, err := δTtail.rebuild(root, δBtail.δZtail, δBtail.db) δtrackSet, err := δTtail.rebuild(root, δBtail.δZtail, δBtail.db)
...@@ -313,7 +316,7 @@ func (δTtail *ΔTtail) rebuild(root zodb.Oid, δZtail *zodb.ΔTail, db *zodb.DB ...@@ -313,7 +316,7 @@ func (δTtail *ΔTtail) rebuild(root zodb.Oid, δZtail *zodb.ΔTail, db *zodb.DB
defer xerr.Context(&err, "ΔTtail rebuild") defer xerr.Context(&err, "ΔTtail rebuild")
// XXX locking // XXX locking
tracefΔBtail("\nRebuild @%s .. @%s\n", δZtail.Tail(), δZtail.Head()) tracefΔBtail("\nRebuild %s @%s .. @%s\n", root, δZtail.Tail(), δZtail.Head())
tracefΔBtail("trackNew: %v\n", δTtail.trackNew) tracefΔBtail("trackNew: %v\n", δTtail.trackNew)
trackNew := δTtail.trackNew trackNew := δTtail.trackNew
...@@ -372,7 +375,7 @@ func (δTtail *ΔTtail) rebuild(root zodb.Oid, δZtail *zodb.ΔTail, db *zodb.DB ...@@ -372,7 +375,7 @@ func (δTtail *ΔTtail) rebuild(root zodb.Oid, δZtail *zodb.ΔTail, db *zodb.DB
zhead, err := db.Open(ctx, &zodb.ConnOptions{At: δZtail.Head()}); /*X*/ if err != nil { return err } zhead, err := db.Open(ctx, &zodb.ConnOptions{At: δZtail.Head()}); /*X*/ if err != nil { return err }
xtree, err := zhead.Get(ctx, root); /*X*/ if err != nil { return err } xtree, err := zhead.Get(ctx, root); /*X*/ if err != nil { return err }
tree := xtree.(*Tree) // must succeed tree := xtree.(*Tree) // must succeed XXX better explicit panic?
top := &nodeInRange{prefix: nil, lo: KeyMin, hi_: KeyMax, node: tree} top := &nodeInRange{prefix: nil, lo: KeyMin, hi_: KeyMax, node: tree}
V := rangeSplit{top} V := rangeSplit{top}
...@@ -399,17 +402,6 @@ func (δTtail *ΔTtail) rebuild(root zodb.Oid, δZtail *zodb.ΔTail, db *zodb.DB ...@@ -399,17 +402,6 @@ func (δTtail *ΔTtail) rebuild(root zodb.Oid, δZtail *zodb.ΔTail, db *zodb.DB
} }
return trackNew, nil return trackNew, nil
/*
// trackNew was adjusted to correspond to @tail potentially growing its key coverage.
// Remap it back to @head and merge to .trackSet
for _, δtrack := range vδtrack {
δtrack.Reverse() // we saved it as lo<-hi; now we go lo->hi
trackNew.ApplyΔ(δtrack)
}
δBtail.trackSet.UnionInplace(trackNew)
return δtrackSet, nil
*/
} }
// rebuild1 rebuilds δT for single δZ. // rebuild1 rebuilds δT for single δZ.
...@@ -603,8 +595,7 @@ if XXX_killWhenRebuildWorks { ...@@ -603,8 +595,7 @@ if XXX_killWhenRebuildWorks {
δBtail.trackSet.ApplyΔ(δtrack) δBtail.trackSet.ApplyΔ(δtrack)
δTKeyCov.ByRoot[root] = δtkeycov δTKeyCov.ByRoot[root] = δtkeycov
// XXX if δtkeycov != ø -> rebuild δTtail // XXX if δtkeycov != ø && len(δZtail) > 1 -> rebuild δTtail
// XXX here? or in the caller?
} }
return δB, δTKeyCov, nil return δB, δTKeyCov, nil
......
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