Commit 7df766ea authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c5c67e47
......@@ -463,19 +463,30 @@ func xverifyΔBTail(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, a
// verify transition at1->at2 for all initial states of tracked {keys} from kv1 + kv2 + ∞
allKeys := SetKey{}; allKeys.Add(kInf) // inf, simulating ZBigFile.Size() query
for _, b := range xkv1 { for k := range b.kv { allKeys.Add(k) }}
for _, b := range xkv2 { for k := range b.kv { allKeys.Add(k) }}
maxk1 := -kInf; maxk2 := -kInf
for _, b := range xkv1 { for k := range b.kv {
allKeys.Add(k)
if k > maxk1 { maxk1 = k }
}}
for _, b := range xkv2 { for k := range b.kv {
allKeys.Add(k)
if k > maxk2 { maxk2 = k }
}}
allKeyv := allKeys.Elements()
sort.Slice(allKeyv, func(i, j int) bool {
return allKeyv[i] < allKeyv[j]
})
// maxkey among kv1+kv2
// it must be present in δB if maxkey tracking is requested.
maxKey := maxk1; if maxk2 > maxk1 { maxKey = maxk2 }
/*
maxKey := -kInf
if l := len(allKeyv); l > 0 {
maxKey = allKeyv[l-1] // FIXME always returns kInf -> rework to be real maxkey
}
*/
// {} k -> adjacent keys. if k is tracked -> changes to adjacents must be in δT.
kadj := map[Key]SetKey{}
......@@ -483,16 +494,22 @@ func xverifyΔBTail(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, a
ka := SetKey{}
if k == kInf {
// XXX update with
// xkv1[maxk1]
// xkv2[maxk2]
// btree grows and maxkey tracked: maxkey from kv2 must be in δT
if maxk2 > maxk1 {
kb := xkv2.Get(maxk2)
for k := range kb.kv { ka.Add(k) }
// no xkv1[maxk1]
// btree shrinks and maxkey tracked:
} else {
// XXX correct?
for k := range xkv1.Get(maxk1).kv { ka.Add(k) }
for k := range xkv2.Get(maxk2).kv { ka.Add(k) }
}
} else {
// XXX correct?
kb := xkv1.Get(k)
for k := range kb.kv { ka.Add(k) }
//// XXX correct?
//ka.Update(xkv1[k])
//ka.Update(xkv2[k])
}
kadj[k] = ka
......
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