Commit ac4ff8df authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 3950de77
...@@ -373,6 +373,7 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) { ...@@ -373,6 +373,7 @@ func (δBtail *ΔBtail) Update(δZ *zodb.EventCommit) (_ ΔB, err error) {
tracef("Update δZ: %v\n", δZ.Changev) tracef("Update δZ: %v\n", δZ.Changev)
tracef("trackIdx: %v\n", δBtail.trackIdx) tracef("trackIdx: %v\n", δBtail.trackIdx)
tracef("holeIdx: %v\n", δBtail.holeIdx)
δZTC, δtopsByRoot := δBtail.δZConnectTracked(δZ) δZTC, δtopsByRoot := δBtail.δZConnectTracked(δZ)
...@@ -633,7 +634,7 @@ func (rs rangeSplit) String() string { ...@@ -633,7 +634,7 @@ func (rs rangeSplit) String() string {
func treediff(ctx context.Context, root zodb.Oid, δtops SetOid, δZTC SetOid, trackIdx map[zodb.Oid]nodeTrack, holeIdx treeSetKey, zconnOld, zconnNew *zodb.Connection) (δT map[Key]ΔValue, err error) { func treediff(ctx context.Context, root zodb.Oid, δtops SetOid, δZTC SetOid, trackIdx map[zodb.Oid]nodeTrack, holeIdx treeSetKey, zconnOld, zconnNew *zodb.Connection) (δT map[Key]ΔValue, err error) {
defer xerr.Contextf(&err, "treediff %s..%s %s", zconnOld.At(), zconnNew.At(), root) defer xerr.Contextf(&err, "treediff %s..%s %s", zconnOld.At(), zconnNew.At(), root)
tracef("treediff %s δtops: %v δZTC: %v\n", root, δtops, δZTC) tracef("\ntreediff %s δtops: %v δZTC: %v\n", root, δtops, δZTC)
defer tracef("\n") defer tracef("\n")
δT = map[Key]ΔValue{} δT = map[Key]ΔValue{}
...@@ -742,6 +743,18 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid] ...@@ -742,6 +743,18 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
Bkqueue := SetKey{} // ----//---- in B for δ+ Bkqueue := SetKey{} // ----//---- in B for δ+
Akdone := SetKey{} // already processed keys in A Akdone := SetKey{} // already processed keys in A
Bkdone := SetKey{} // ----//---- in B Bkdone := SetKey{} // ----//---- in B
Aktodo := func(k Key) {
if !Akdone.Has(k) {
tracef(" Akqueue += %d\n", k)
Akqueue.Add(k)
}
}
Bktodo := func(k Key) {
if !Bkdone.Has(k) {
tracef(" Bkqueue += %d\n", k)
Bkqueue.Add(k)
}
}
// {} oid -> parent for all nodes in Bv: current and previously expanded - up till top B // {} oid -> parent for all nodes in Bv: current and previously expanded - up till top B
// XXX // XXX
...@@ -770,21 +783,21 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid] ...@@ -770,21 +783,21 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
// Bkqueue <- δA // Bkqueue <- δA
for k := range δA { for k := range δA {
Akdone.Add(k) Akdone.Add(k)
if !Bkdone.Has(k) { Bktodo(k)
Bkqueue.Add(k)
}
} }
// Bkqueue <- holes(ra.range) // Bkqueue <- holes(ra.range)
for k := range holeIdx.GetInRange(ra.lo, ra.hi_) { for k := range holeIdx.GetInRange(ra.lo, ra.hi_) {
if !Bkdone.Has(k) { Bktodo(k)
Bkqueue.Add(k)
}
} }
ra.done = true ra.done = true
case *Tree: case *Tree:
// empty tree - XXX no need to check? // empty tree - queue holes covered by it
if len(a.Entryv()) == 0 { if len(a.Entryv()) == 0 {
for k := range holeIdx.GetInRange(ra.lo, ra.hi_) {
Bktodo(k)
}
continue
} }
// a is normal tree - expand it and queue children // a is normal tree - expand it and queue children
...@@ -876,9 +889,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid] ...@@ -876,9 +889,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
// Akqueue <- δB // Akqueue <- δB
for k_ := range δB { for k_ := range δB {
Bkdone.Add(k_) Bkdone.Add(k_)
if !Akdone.Has(k_) { Aktodo(k_)
Akqueue.Add(k_)
}
} }
b.done = true b.done = true
...@@ -904,15 +915,11 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid] ...@@ -904,15 +915,11 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
// Bkqueue <- δA // Bkqueue <- δA
for k_ := range δA { for k_ := range δA {
Akdone.Add(k_) Akdone.Add(k_)
if !Bkdone.Has(k_) { Bktodo(k_)
Bkqueue.Add(k_)
}
} }
// Bkqueue <- holes(a.range) // Bkqueue <- holes(a.range)
for k_ := range holeIdx.GetInRange(a.lo, a.hi_) { for k_ := range holeIdx.GetInRange(a.lo, a.hi_) {
if !Bkdone.Has(k_) { Bktodo(k_)
Bkqueue.Add(k_)
}
} }
a.done = true a.done = true
......
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