Commit 1717400a authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent f2d3cd40
...@@ -38,7 +38,7 @@ import ( ...@@ -38,7 +38,7 @@ import (
const XXX_killWhenRebuildWorks = true const XXX_killWhenRebuildWorks = true
const traceΔBtail = true const traceΔBtail = true
const debugΔBtail = false const debugΔBtail = true
// ΔBtail represents tail of revisional changes to BTrees. // ΔBtail represents tail of revisional changes to BTrees.
...@@ -222,7 +222,7 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, nodePath []Node) error { ...@@ -222,7 +222,7 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, nodePath []Node) error {
pathv := []string{} pathv := []string{}
for _, node := range nodePath { pathv = append(pathv, vnode(node)) } for _, node := range nodePath { pathv = append(pathv, vnode(node)) }
tracefΔBtail("Track [%v] %s\n", key, strings.Join(pathv, " -> ")) tracefΔBtail("\nTrack [%v] %s\n", key, strings.Join(pathv, " -> "))
return δBtail.track(key, keyPresent, path) return δBtail.track(key, keyPresent, path)
} }
...@@ -233,7 +233,6 @@ func (δBtail *ΔBtail) track(key Key, keyPresent bool, path []zodb.Oid) error { ...@@ -233,7 +233,6 @@ func (δBtail *ΔBtail) track(key Key, keyPresent bool, path []zodb.Oid) error {
// track is track of path[-1] (i.e. leaf) // track is track of path[-1] (i.e. leaf)
// XXX hack - until rebuild is implemented // XXX hack - until rebuild is implemented
if XXX_killWhenRebuildWorks { if XXX_killWhenRebuildWorks {
_, ok := δBtail.byRoot[root] _, ok := δBtail.byRoot[root]
...@@ -253,8 +252,9 @@ func (δBtail *ΔBtail) rebuild() (err error) { ...@@ -253,8 +252,9 @@ func (δBtail *ΔBtail) rebuild() (err error) {
defer xerr.Context(&err, "ΔBtail rebuild") defer xerr.Context(&err, "ΔBtail rebuild")
// XXX locking // XXX locking
// XXX tracefΔBtail rebuild @head tracefΔBtail("\nRebuild @%s .. @%s\n", δBtail.Tail(), δBtail.Head())
// XXX tracefΔBtail trackNew: ... tracefΔBtail("trackSet: %v\n", δBtail.trackSet)
tracefΔBtail("trackNew: %v\n", δBtail.trackNew)
trackNew := δBtail.trackNew trackNew := δBtail.trackNew
δBtail.trackNew = PPTreeSubSet{} δBtail.trackNew = PPTreeSubSet{}
...@@ -280,10 +280,10 @@ func (δBtail *ΔBtail) rebuild() (err error) { ...@@ -280,10 +280,10 @@ func (δBtail *ΔBtail) rebuild() (err error) {
δZTC, δtopsByRoot := δZConnectTracked(δZ.Changev, trackNew) δZTC, δtopsByRoot := δZConnectTracked(δZ.Changev, trackNew)
debugfΔBtail("\nrebuild @%s <- @%s\n", atPrev, δZ.Rev) debugfΔBtail("\n rebuild @%s <- @%s\n", atPrev, δZ.Rev)
debugfΔBtail("δZ:\t%v\n", δZ.Changev) debugfΔBtail(" δZ:\t%v\n", δZ.Changev)
debugfΔBtail("trackNew: %v\n", trackNew) debugfΔBtail(" trackNew: %v\n", trackNew)
debugfΔBtail("trackSet: %v\n", δBtail.trackSet) // XXX needed? debugfΔBtail(" trackSet: %v\n", δBtail.trackSet) // XXX needed?
defer debugfΔBtail("\n\n") defer debugfΔBtail("\n\n")
// XXX len(δtopsByRoot) == 0 -> skip // XXX len(δtopsByRoot) == 0 -> skip
...@@ -309,7 +309,7 @@ func (δBtail *ΔBtail) rebuild() (err error) { ...@@ -309,7 +309,7 @@ func (δBtail *ΔBtail) rebuild() (err error) {
return err return err
} }
debugfΔBtail("-> root<%s> δkv*: %v δtrack*: %v\n", root, δT, δtrack) debugfΔBtail(" -> root<%s> δkv*: %v δtrack*: %v\n", root, δT, δtrack)
trackNew.ApplyΔ(δtrack) trackNew.ApplyΔ(δtrack)
vδtrack = append([]*ΔPPTreeSubSet{δtrack}, vδtrack...) vδtrack = append([]*ΔPPTreeSubSet{δtrack}, vδtrack...)
...@@ -382,6 +382,10 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) { ...@@ -382,6 +382,10 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
headOld := δBtail.Head() headOld := δBtail.Head()
defer xerr.Contextf(&err, "ΔBtail update %s -> %s", headOld, δZ.Tid) defer xerr.Contextf(&err, "ΔBtail update %s -> %s", headOld, δZ.Tid)
tracefΔBtail("\nUpdate @%s -> @%s δZ: %v\n", δBtail.Head(), δZ.Tid, δZ.Changev)
tracefΔBtail("trackSet: %v\n", δBtail.trackSet)
tracefΔBtail("trackNew: %v\n", δBtail.trackNew)
if XXX_killWhenRebuildWorks { if XXX_killWhenRebuildWorks {
// XXX hack - until vvv is reenabled // XXX hack - until vvv is reenabled
δBtail.trackSet.UnionInplace(δBtail.trackNew) δBtail.trackSet.UnionInplace(δBtail.trackNew)
...@@ -395,10 +399,6 @@ if XXX_killWhenRebuildWorks { ...@@ -395,10 +399,6 @@ if XXX_killWhenRebuildWorks {
} }
} }
tracefΔBtail("Update @%s -> @%s\n", δBtail.Head(), δZ.Tid)
tracefΔBtail("δZ:\t%v\n", δZ.Changev)
debugfΔBtail("trackSet: %v\n", δBtail.trackSet)
// XXX dup wrt rebuild? // XXX dup wrt rebuild?
δBtail.δZtail.Append(δZ.Tid, δZ.Changev) δBtail.δZtail.Append(δZ.Tid, δZ.Changev)
...@@ -431,7 +431,7 @@ if XXX_killWhenRebuildWorks { ...@@ -431,7 +431,7 @@ if XXX_killWhenRebuildWorks {
return ΔB{}, err return ΔB{}, err
} }
debugfΔBtail("\n-> root<%s> δkv: %v δtrack: %v\n", root, δT, δtrack) tracefΔBtail("\n-> root<%s> δkv: %v δtrack: %v\n", root, δT, δtrack)
if len(δT) > 0 { // an object might be resaved without change if len(δT) > 0 { // an object might be resaved without change
δB.ByRoot[root] = δT δB.ByRoot[root] = δT
......
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