Commit 92fe0aa7 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 10ca3c4e
......@@ -516,6 +516,7 @@ func (δBtail *ΔBtail) δZConnectTracked(δZv *zodb.EventCommit) (δZTC SetOid,
type nodeInRange struct {
lo, hi_ Key // [lo, hi_] NOTE _not_ hi) not to overflow at ∞
node Node
done bool // whether this node was already taken into account while computing diff
}
// rangeSplit represents set of nodes covering a range.
......@@ -583,7 +584,11 @@ func (prs *rangeSplit) Expand(rnode *nodeInRange) (children rangeSplit) {
hi_ = treev[i+1].Key()-1 // NOTE -1
}
children = append(children, &nodeInRange{lo, hi_, treev[i].Child()})
children = append(children, &nodeInRange{
lo: lo,
hi_: hi_,
node: treev[i].Child(),
})
}
// fmt.Printf("E children: %s\n", children)
......@@ -793,6 +798,7 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
Bqueue.Add(k)
}
arn.done = true
continue
}
......@@ -837,6 +843,8 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
Adone.Add(k)
Bqueue.Add(k)
}
rchild.done = true
}
}
}
......@@ -865,28 +873,36 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
for k := range Bqueue {
Bdone.Add(k)
bbucket, ok, err := bv.GetToBucket(ctx, k)
if err != nil {
return nil, err
}
if !ok {
// FIXME -> key must be included into some node.hole
continue // key not covered
}
// XXX check bucket for already "done" (i.e. taken into account)
δB, err := diffB(ctx, nil, bbucket.node.(*Bucket))
if err != nil {
return nil, err
}
// + bucket if not already done
// XXX update track.hole if k not in bbucket
if !bbucket.done {
δB, err := diffB(ctx, nil, bbucket.node.(*Bucket))
if err != nil {
return nil, err
}
// δ <- δB
err = δMerge(δ, δB)
if err != nil {
return nil, err
}
// δ <- δB
err = δMerge(δ, δB)
if err != nil {
return nil, err
}
// Aqueue <- δB
for k := range δB {
if !Adone.Has(k) {
Aqueue.Add(k)
// Aqueue <- δB
for k := range δB {
if !Adone.Has(k) {
Aqueue.Add(k)
}
}
bbucket.done = true
}
}
......@@ -896,35 +912,40 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
for k := range Aqueue {
Adone.Add(k)
abucket, ok, err := av.GetToBucket(ctx, k)
if err != nil {
return nil, err
}
if !ok {
// FIXME -> key must be included into some node.hole
continue // key not covered
}
// XXX check bucket for already "done"
δA, err := diffB(ctx, abucket.node.(*Bucket), nil)
if err != nil {
return nil, err
}
// - bucket if not already done
// XXX also extract holes
if !abucket.done {
δA, err := diffB(ctx, abucket.node.(*Bucket), nil)
if err != nil {
return nil, err
}
// δ <- δA
err = δMerge(δ, δA)
if err != nil {
return nil, err
}
// δ <- δA
err = δMerge(δ, δA)
if err != nil {
return nil, err
}
// Bqueue <- δA
for k := range δA {
if !Bdone.Has(k) {
Bqueue.Add(k)
// Bqueue <- δA
for k := range δA {
if !Bdone.Has(k) {
Bqueue.Add(k)
}
}
abucket.done = true
}
}
}
return δ, nil
}
......
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