Commit 2f9a46eb authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 69449694
......@@ -966,7 +966,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
fmt.Printf("@%s: %v\n", xat[t1.at], t1.xkv.Flatten())
fmt.Printf("@%s: %v\n", xat[t2.at], t2.xkv.Flatten())
kadj01 := KAdj(t0,t1, allTestKeys(t0,t1,t2))
// kadj01 := KAdj(t0,t1, allTestKeys(t0,t1,t2))
kadj10 := KAdj(t1,t0, allTestKeys(t0,t1,t2))
kadj21 := KAdj(t2,t1, allTestKeys(t0,t1,t2))
kadj12 := KAdj(t1,t2, allTestKeys(t0,t1,t2))
......@@ -1011,11 +1011,38 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
/*vδT=*/ δkv1_1)
t.Run((" →" + t2.tree), func(t *testing.T) {
// tracked keys1 becomes tracked keys1_2 after Update(t1->t2)
// keys1_2 := kadj12.Map(keys1)
keys1_2 := kadj12.Map(kadj01.Map(keys1_0))
xverifyΔBTail_rebuild_U(t, δbtail, db, treeRoot, t1, t2, xat, /*trackSet=*/t2.xkv.trackSet(keys1_2))
// XXX +vδT=δkv1_2, δkv2_2
// keys1R2 is full set of keys that should become tracked after
// Update() (which includes rebuild)
keys1R2 := kadj12.Map(keys1)
for {
keys1R2_ := kadj10.Map(kadj21.Map(keys1R2))
if keys1R2.Equal(keys1R2_) {
break
}
keys1R2 = keys1R2_
}
// δkvX_k1R2 = tX.δxkv / keys1R2
δkv1_k1R2 := map[Key]Δstring{}
δkv2_k1R2 := map[Key]Δstring{}
for k := range keys1R2 {
δv1, ok := t1.δxkv[k]
if ok {
δkv1_k1R2[k] = δv1
}
δv2, ok := t2.δxkv[k]
if ok {
δkv2_k1R2[k] = δv2
}
}
// // tracked keys1 becomes tracked keys1_2 after Update(t1->t2)
//// keys1_2 := kadj12.Map(keys1)
// keys1_2 := kadj12.Map(kadj01.Map(keys1_0))
xverifyΔBTail_rebuild_U(t, δbtail, db, treeRoot, t1, t2, xat,
// /*trackSet=*/t2.xkv.trackSet(keys1_2),
/*trackSet=*/t2.xkv.trackSet(keys1R2),
/*vδT=*/ δkv1_k1R2, δkv2_k1R2)
// tRestKeys2 = tAllKeys - keys1
tRestKeys2 := tAllKeys.Difference(keys1)
......@@ -1026,43 +1053,44 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
keys2.Add(tRestKeyv2[idx2])
}
// find out full set of keys that should become tracked after
// keys12R2 is full set of keys that should become tracked after
// Track(keys2) + rebuild
keys12R := keys1_2.Union(keys2)
keys12R2 := keys1R2.Union(keys2)
for {
keys12R_ := kadj10.Map(kadj21.Map(keys12R))
if keys12R.Equal(keys12R_) {
keys12R2_ := kadj10.Map(kadj21.Map(keys12R2))
if keys12R2.Equal(keys12R2_) {
break
}
keys12R = keys12R_
keys12R2 = keys12R2_
}
// δkv1_2 = t1.δxkv / kadj10(kadj21(kadj12(keys1) | keys2))
// δkv2_2 = t2.δxkv / kadj10(kadj21(kadj12(keys1) | keys2))
// keys12_2 := keys1_2.Union(keys2)
// keys12_0 := kadj10.Map(kadj21.Map(keys12_2))
// // δkv1_2 = t1.δxkv / kadj10(kadj21(kadj12(keys1) | keys2))
// // δkv2_2 = t2.δxkv / kadj10(kadj21(kadj12(keys1) | keys2))
//// keys12_2 := keys1_2.Union(keys2)
//// keys12_0 := kadj10.Map(kadj21.Map(keys12_2))
fmt.Printf("\n\n\nKKK\nkeys1=%s keys2=%s\n", keys1, keys2)
fmt.Printf("keys12R=%s\n", keys12R)
fmt.Printf("keys12R2=%s\n", keys12R2)
fmt.Printf("t0.xkv: %v\n", t0.xkv)
fmt.Printf("t1.xkv: %v\n", t1.xkv)
fmt.Printf("t2.xkv: %v\n", t2.xkv)
fmt.Printf("kadj21: %v\n", kadj21)
fmt.Printf("kadj12: %v\n", kadj12)
fmt.Printf("t2.xkv.trackSet(%s) -> %s", keys12R, t2.xkv.trackSet(keys12R))
fmt.Printf("t2.xkv.trackSet(%s) -> %s", keys12R2, t2.xkv.trackSet(keys12R2))
fmt.Printf("\n\n\n")
δkv1_2 := map[Key]Δstring{}
δkv2_2 := map[Key]Δstring{}
for k := range keys12R {
// δkvX_k12R2 = tX.δxkv / keys12R2
δkv1_k12R2 := map[Key]Δstring{}
δkv2_k12R2 := map[Key]Δstring{}
for k := range keys12R2 {
δv1, ok := t1.δxkv[k]
if ok {
δkv1_2[k] = δv1
δkv1_k12R2[k] = δv1
}
δv2, ok := t2.δxkv[k]
if ok {
δkv2_2[k] = δv2
δkv2_k12R2[k] = δv2
}
}
......@@ -1072,15 +1100,17 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
xverifyΔBTail_rebuild_TR(t, db, δbtail_, t2, treeRoot, xat,
// after Track(keys2)
keys2,
/*trackSet*/ t2.xkv.trackSet(keys1_2),
// /*trackSet*/ t2.xkv.trackSet(keys1_2),
/*trackSet*/ t2.xkv.trackSet(keys1R2),
/*trackNew*/ t2.xkv.trackSet(keys2).Difference(
// trackNew should not cover ranges that are
// already in trackSet
t2.xkv.trackSet(keys1_2)),
// t2.xkv.trackSet(keys1_2)),
t2.xkv.trackSet(keys1R2)),
// after rebuild
/* trackSet=*/ t2.xkv.trackSet(keys12R),
/*vδT=*/ δkv1_2, δkv2_2)
/* trackSet=*/ t2.xkv.trackSet(keys12R2),
/*vδT=*/ δkv1_k12R2, δkv2_k12R2)
// })
}
})
......
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