Commit 1926b828 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 21ccc7ba
......@@ -30,7 +30,7 @@ package main
// ex δ(T/B1:a, T2/B1:b-B3:c) = {1:a 3:c}
//
// Δ(T, Av, Bv) - subset of δ(Av, Bv) corresponding to initial tracking set T
// ex Δ({1}, T/B1:a, T2/B1:b-B3:c) = {1:a} (no 3:c)
// ex Δ({1}, T/B1:a, T2/B1:b-B3:c) = {1:b} (no 3:c)
//
// kadj(A,B) {} k -> {k'}: - adjacency matrix
// ∃v1,v2: k'∈ Δ({k}, Av1, Bv2)
......@@ -299,6 +299,7 @@ func (rbs RBucketSet) Get(k Key) *RBucket {
return rb
}
// coverage returns string representation of rbs coverage structure.
func (rbs RBucketSet) coverage() string {
if len(rbs) == 0 {
return "ø"
......@@ -392,52 +393,6 @@ func xwalkDFS(ctx context.Context, lo, hi Key, ztree *Tree, bvisit func(*RBucket
}
/* XXX kill
err = ztree.PActivate(ctx); X(err)
defer ztree.PDeactivate()
// XXX better load through direct nodes traversal, not via bucket.next?
// (firstbucket and .next are secondary and might be broken)
zbucket := ztree.FirstBucket()
xkv := make(map[Key]map[Key]string)
for zbucket != nil {
err = zbucket.PActivate(ctx); X(err)
defer zbucket.PDeactivate()
bkv := make(map[Key]string)
bentryv := zbucket.Entryv()
if len(bentryv) == 0 {
exc.Raisef("bucket %s is empty", zbucket.POid())
}
for _, __ := range bentryv {
k := __.Key()
xv := __.Value()
zv, ok := xv.(zBlk)
if !ok {
exc.Raisef("[%d] -> %s; want ZBlk", k, typeOf(xv))
}
data, _, err := zv.loadBlkData(ctx); X(err)
bkv[k] = string(data)
}
path :=
bentryv[0].Key()
bentryv[len(bentryv)-1].Key()
for k := range bkv {
xkv[k] = bkv
}
zbucket = zbucket.Next()
}
return xkv
}
*/
// XGetKV translates {k -> <oid>} to {k -> ZBlk(oid).data} according to db@at snapshot.
func XGetKV(db *zodb.DB, at zodb.Tid, kvOid map[Key]Value) map[Key]string {
defer exc.Contextf("%s: @%s: get kv %v", db.Storage().URL(), at, kvOid)
......@@ -491,11 +446,7 @@ func xverifyΔBTail(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, a
})
// maxkey among kv1+kv2
// it must be present in δB if maxkey tracking is requested.
// maxKey := maxk1; if maxk2 > maxk1 { maxKey = maxk2 }
// {} k -> adjacent keys. if k is tracked -> changes to adjacents must be in δT.
// kadj = {} k -> adjacent keys. if k is tracked -> changes to adjacents must be in δT.
kadj := map[Key]SetKey{}
for k := range allKeys {
ka := SetKey{}
......@@ -523,33 +474,24 @@ func xverifyΔBTail(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, a
kadj[k] = ka
}
/*
// k=∞ simulating ZBigFile.Size() query
allKeys.Add(kInf)
allKeyv = append(allKeyv, kInf)
kadj[kInf] = SetKey{}
for k_ := range xkv1.Get(maxk1).kv { kadj[kInf].Add(k_) }
for k_ := range xkv2.Get(maxk2).kv { kadj[kInf].Add(k_) }
*/
if kadjOK != nil && !reflect.DeepEqual(kadj, kadjOK) {
panic(fmt.Sprintf("BUG: %s: computed kadj is wrong:\nkadjOK: %v\nkadj : %v\n", subj, kadjOK, kadj))
}
// verify at1->at2 for all combination of initial tracked keys.
for kidx := range IntSets(len(allKeyv)) {
keys := SetKey{}
for _, idx := range kidx {
keys.Add(allKeyv[idx])
}
//xverifyΔBTail1(t, subj, db, treeRoot, at1,at2, d12, maxKey, δZ, keys, kadj)
xverifyΔBTail1(t, subj, db, treeRoot, at1,at2, d12, δZ, keys, kadj)
}
}
// xverifyΔBTail1 verifies how ΔBTail handles ZODB update at1->at2 from initial
// tracked state defined by initialTrackedKeys.
//func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.Tid, d12 map[Key]string, maxKey Key, δZ *zodb.EventCommit, initialTrackedKeys SetKey, kadj map[Key]SetKey) {
func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid, at1,at2 zodb.Tid, d12 map[Key]string, δZ *zodb.EventCommit, initialTrackedKeys SetKey, kadj map[Key]SetKey) {
X := exc.Raiseif
assert := require.New(t)
......
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