Commit fc61ff19 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent ef5e5183
......@@ -82,7 +82,7 @@ import (
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xzodb"
)
const traceDiff = false
const traceDiff = true
const debugDiff = false
// ΔValue represents change in value.
......@@ -481,6 +481,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
// this way, if later, the subtree will be recreated, that change won't be missed
δtrack.Del.AddPath(ABpath)
δtrack.Add.AddPath(ABpath)
// δtkeycov stays ø
}
// A|B == nil -> artificial empty tree
......@@ -532,6 +533,10 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
BtrackSet.AddPath(ABpath)
}
// δtkeycov will be = BAdd \ ADel
δtkeycovADel := &RangedKeySet{}
δtkeycovBAdd := &RangedKeySet{}
// phase 1: expand A top->down driven by δZTC.
// by default a node contributes to δ-
// a node ac does not contribute to δ- and can be skipped, if:
......@@ -554,9 +559,11 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
δA, err := diffB(ctx, a, nil); /*X*/if err != nil { return nil,nil,nil, err }
err = δMerge(δ, δA); /*X*/if err != nil { return nil,nil,nil, err }
δtrack.Del.AddPath(ra.Path())
ar := KeyRange{ra.lo, ra.hi_}
δtkeycovADel.AddRange(ar)
// Bkqueue <- ra.range
Bktodo(KeyRange{ra.lo, ra.hi_})
Bktodo(ar)
ra.done = true
case *Tree:
......@@ -625,6 +632,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
if nc := at.nchild; nc != 0 {
δtrack.δnchildNonLeafs[acOid] = nc
}
// XXX δtkeycov
}
continue
......@@ -680,9 +688,10 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
// δ <- δB
err = δMerge(δ, δB); /*X*/if err != nil { return nil,nil,nil, err }
δtrack.Add.AddPath(b.Path())
br := KeyRange{b.lo, b.hi_}
δtkeycovBAdd.AddRange(br)
// Akqueue <- δB
br := KeyRange{b.lo, b.hi_}
Bkdone.AddRange(br)
Aktodo(br)
......@@ -717,9 +726,10 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
// δ <- δA
err = δMerge(δ, δA); /*X*/if err != nil { return nil,nil,nil, err }
δtrack.Del.AddPath(a.Path())
ar := KeyRange{a.lo, a.hi_}
δtkeycovADel.AddRange(ar)
// Bkqueue <- a.range
ar := KeyRange{a.lo, a.hi_}
Akdone.AddRange(ar)
Bktodo(ar)
......@@ -736,6 +746,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
Akqueue.Clear()
}
δtkeycov = δtkeycovBAdd.Difference(δtkeycovADel)
return δ, δtrack, δtkeycov, nil
}
......
......@@ -835,11 +835,11 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
return
}
// assert δtkeyCov == δ(tkeyCov1, tkeyCov2)
δtkeyCovOK := tkeyCov2.Difference(tkeyCov1)
δtkeyCov := δTKeyCov.ByRoot[treeRoot]
if !δtkeyCov.Equal(δtkeyCovOK) {
badf("δtkeyCov wrong:\nhave: %s\nwant: %s", δtkeyCov, δtkeyCovOK)
// assert δtkeycov == δ(tkeyCov1, tkeyCov2)
δtkeycovOK := tkeyCov2.Difference(tkeyCov1)
δtkeycov := δTKeyCov.ByRoot[treeRoot]
if !δtkeycov.Equal(δtkeycovOK) {
badf("δtkeycov wrong:\nhave: %s\nwant: %s", δtkeycov, δtkeycovOK)
}
......
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