Commit ece1c216 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 8b595000
...@@ -877,7 +877,6 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid] ...@@ -877,7 +877,6 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
Aqueue = SetKey{} Aqueue = SetKey{}
for k := range Bqueue { for k := range Bqueue {
fmt.Printf(" B [%v]\n", k) fmt.Printf(" B [%v]\n", k)
Bdone.Add(k)
bnode, ok, err := bv.GetToLeaf(ctx, k) bnode, ok, err := bv.GetToLeaf(ctx, k)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -889,8 +888,7 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid] ...@@ -889,8 +888,7 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
// XXX check for bnode.node.(*Tree) (ø tree case) // XXX check for bnode.node.(*Tree) (ø tree case)
// + bucket if not already done // +bucket if that bucket is reached for the first time
// XXX update track.hole if k not in bbucket
if !bnode.done { if !bnode.done {
δB, err := diffB(ctx, nil, bnode.node.(*Bucket)) δB, err := diffB(ctx, nil, bnode.node.(*Bucket))
if err != nil { if err != nil {
...@@ -903,16 +901,25 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid] ...@@ -903,16 +901,25 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
return nil, err return nil, err
} }
// Bdone <- δB
// Aqueue <- δB // Aqueue <- δB
for k := range δB { for k_ := range δB {
if !Adone.Has(k) { Bdone.Add(k_)
Aqueue.Add(k) if !Adone.Has(k_) {
Aqueue.Add(k_)
} }
} }
bnode.done = true bnode.done = true
} }
// add k as hole if k is not there
if !Bdone.Has(k) {
δB := map[Key]ΔValue{k: {VDEL, VDEL}} // hole
err = δMerge(δ, δB); if err != nil { return nil, err }
Bdone.Add(k)
}
fmt.Printf(" bv: %s\n", bv) fmt.Printf(" bv: %s\n", bv)
} }
...@@ -1000,7 +1007,7 @@ func δMerge(δ, δ2 map[Key]ΔValue) error { ...@@ -1000,7 +1007,7 @@ func δMerge(δ, δ2 map[Key]ΔValue) error {
if δv.Old != δv.New { if δv.Old != δv.New {
δ[k] = δv δ[k] = δv
} else { } else {
delete(δ, k) delete(δ, k) // NOTE also annihilates hole migration
} }
} }
......
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