Commit c112b414 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent d3e4212a
...@@ -745,13 +745,13 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid] ...@@ -745,13 +745,13 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
Bkdone := SetKey{} // ----//---- in B Bkdone := SetKey{} // ----//---- in B
Aktodo := func(k Key) { Aktodo := func(k Key) {
if !Akdone.Has(k) { if !Akdone.Has(k) {
tracef(" Akqueue += %d\n", k) tracef(" Akq <- %d\n", k)
Akqueue.Add(k) Akqueue.Add(k)
} }
} }
Bktodo := func(k Key) { Bktodo := func(k Key) {
if !Bkdone.Has(k) { if !Bkdone.Has(k) {
tracef(" Bkqueue += %d\n", k) tracef(" Bkq <- %d\n", k)
Bkqueue.Add(k) Bkqueue.Add(k)
} }
} }
...@@ -768,11 +768,14 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid] ...@@ -768,11 +768,14 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
// - ac ∉ δZTC && ∃ bc from B: ac.oid == bc.oid (ac was not changed and stays in the tree) // - ac ∉ δZTC && ∃ bc from B: ac.oid == bc.oid (ac was not changed and stays in the tree)
Aq := []*nodeInRange{atop} // queue for A nodes that contribyte to δ- Aq := []*nodeInRange{atop} // queue for A nodes that contribyte to δ-
for len(Aq) > 0 { for len(Aq) > 0 {
tracef("\n")
tracef(" aq: %v\n", Aq)
tracef(" av: %s\n", Av) tracef(" av: %s\n", Av)
tracef(" bv: %s\n", Bv) tracef(" bv: %s\n", Bv)
ra := pop(&Aq) ra := pop(&Aq)
err = ra.node.PActivate(ctx); /*X*/if err != nil { return nil, err } err = ra.node.PActivate(ctx); /*X*/if err != nil { return nil, err }
defer ra.node.PDeactivate() defer ra.node.PDeactivate()
tracef(" a: %s\n", ra)
switch a := ra.node.(type) { switch a := ra.node.(type) {
case *Bucket: case *Bucket:
...@@ -877,8 +880,15 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid] ...@@ -877,8 +880,15 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
// * +B23, ... // * +B23, ...
tracef("\nphase 2:\n") tracef("\nphase 2:\n")
for len(Bkqueue) > 0 { for len(Bkqueue) > 0 {
tracef("\n")
tracef(" av: %s\n", Av)
tracef(" bv: %s\n", Bv)
tracef("\n")
tracef(" Bkq: %s\n", Bkqueue)
for k := range Bkqueue { for k := range Bkqueue {
b, err := Bv.GetToLeaf(ctx, k); /*X*/if err != nil { return nil, err } b, err := Bv.GetToLeaf(ctx, k); /*X*/if err != nil { return nil, err }
tracef(" B k%d -> %s\n", k, b)
// +bucket if that bucket is reached for the first time // +bucket if that bucket is reached for the first time
if !b.done { if !b.done {
var δB map[Key]ΔValue var δB map[Key]ΔValue
...@@ -903,13 +913,16 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid] ...@@ -903,13 +913,16 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
} }
Bkqueue = SetKey{} Bkqueue = SetKey{}
tracef("\n")
tracef(" Akq: %s\n", Akqueue)
for k := range Akqueue { for k := range Akqueue {
a, err := Av.GetToLeaf(ctx, k); /*X*/if err != nil { return nil, err } a, err := Av.GetToLeaf(ctx, k); /*X*/if err != nil { return nil, err }
tracef(" A k%d -> %s\n", k, a)
// -bucket if that bucket is reached for the first time // -bucket if that bucket is reached for the first time
if !a.done { if !a.done {
var δA map[Key]ΔValue var δA map[Key]ΔValue
abucket, ok := a.node.(*Bucket) abucket, ok := a.node.(*Bucket)
if !ok { // !ok means ø tree if ok { // !ok means ø tree
δA, err = diffB(ctx, abucket, nil); /*X*/if err != nil { return nil, err } δA, err = diffB(ctx, abucket, nil); /*X*/if err != nil { return nil, err }
} }
......
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