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) {
tracef("Update δZ: %v\n", δZ.Changev)
tracef("trackIdx: %v\n", δBtail.trackIdx)
tracef("holeIdx: %v\n", δBtail.holeIdx)
δZTC, δtopsByRoot := δBtail.δZConnectTracked(δZ)
......@@ -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) {
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")
δT = map[Key]ΔValue{}
......@@ -742,6 +743,18 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
Bkqueue := SetKey{} // ----//---- in B for δ+
Akdone := SetKey{} // already processed keys in A
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
// XXX
......@@ -770,21 +783,21 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
// Bkqueue <- δA
for k := range δA {
Akdone.Add(k)
if !Bkdone.Has(k) {
Bkqueue.Add(k)
}
Bktodo(k)
}
// Bkqueue <- holes(ra.range)
for k := range holeIdx.GetInRange(ra.lo, ra.hi_) {
if !Bkdone.Has(k) {
Bkqueue.Add(k)
}
Bktodo(k)
}
ra.done = true
case *Tree:
// empty tree - XXX no need to check?
// empty tree - queue holes covered by it
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
......@@ -876,9 +889,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
// Akqueue <- δB
for k_ := range δB {
Bkdone.Add(k_)
if !Akdone.Has(k_) {
Akqueue.Add(k_)
}
Aktodo(k_)
}
b.done = true
......@@ -904,15 +915,11 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
// Bkqueue <- δA
for k_ := range δA {
Akdone.Add(k_)
if !Bkdone.Has(k_) {
Bkqueue.Add(k_)
}
Bktodo(k_)
}
// Bkqueue <- holes(a.range)
for k_ := range holeIdx.GetInRange(a.lo, a.hi_) {
if !Bkdone.Has(k_) {
Bkqueue.Add(k_)
}
Bktodo(k_)
}
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