Commit 8b548533 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent df8d0694
...@@ -498,6 +498,7 @@ func (tidx trackIndex) AddPath(path []zodb.Oid) { ...@@ -498,6 +498,7 @@ func (tidx trackIndex) AddPath(path []zodb.Oid) {
// rebuild rebuilds ΔBtree taking trackNew requests into account. XXX // rebuild rebuilds ΔBtree taking trackNew requests into account. XXX
// XXX place // XXX place
func (δBtail *ΔBtail) rebuild() { func (δBtail *ΔBtail) rebuild() {
return
panic("TODO") panic("TODO")
} }
......
...@@ -794,7 +794,6 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod ...@@ -794,7 +794,6 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
// t0->t1 exercises from-scratch rebuild, // t0->t1 exercises from-scratch rebuild,
// t1->t2 further exercises incremental rebuild. // t1->t2 further exercises incremental rebuild.
func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1, t2 *tTreeCommit) { func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1, t2 *tTreeCommit) {
return
tAllKeys := allTestKeys(t0, t1, t2) tAllKeys := allTestKeys(t0, t1, t2)
tAllKeyv := tAllKeys.SortedElements() tAllKeyv := tAllKeys.SortedElements()
...@@ -810,6 +809,14 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1 ...@@ -810,6 +809,14 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
fmt.Printf("@%s: %v\n", xat[t1.at], xkvFlatten(t1.xkv)) fmt.Printf("@%s: %v\n", xat[t1.at], xkvFlatten(t1.xkv))
fmt.Printf("@%s: %v\n", xat[t2.at], xkvFlatten(t2.xkv)) fmt.Printf("@%s: %v\n", xat[t2.at], xkvFlatten(t2.xkv))
d01 := kvdiff(xkvFlatten(t0.xkv), xkvFlatten(t1.xkv))
d12 := kvdiff(xkvFlatten(t1.xkv), xkvFlatten(t2.xkv))
kadj01 := KAdj(t0,t1) // FIXME for all keys from t0,t1,t2
kadj12 := KAdj(t1,t2) // FIXME for all keys from t0,t1,t2
ø := SetKey{}
// verify t0 -> t1 Track(keys1) -> t2 Track(keys2) // verify t0 -> t1 Track(keys1) -> t2 Track(keys2)
// for all combinations of keys1 and keys2 // for all combinations of keys1 and keys2
for k1idx := range IntSets(len(tAllKeyv)) { for k1idx := range IntSets(len(tAllKeyv)) {
...@@ -818,14 +825,27 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1 ...@@ -818,14 +825,27 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
keys1.Add(tAllKeyv[idx1]) keys1.Add(tAllKeyv[idx1])
} }
t.Run(fmt.Sprintf("%s→%s;track=%s;rebuild", t0.tree, t1.tree, keys1), func(t *testing.T) { t.Run(fmt.Sprintf("rebuild/%s→%s;track=%s;R", t0.tree, t1.tree, keys1), func(t *testing.T) {
δbtail := NewΔBtail(t0.at, db) δbtail := NewΔBtail(t0.at, db)
// assert trackIdx=ø, newTrackIdx=ø, vδB=[]
assertTrack(t, "@at0", δbtail.trackIdx, ø) // XXX + newTrackIdx, XXX vδB
assertTrack(t, "@at1", δbtail.trackIdx, xkv1.trackIdx(keys1))
xverifyΔBTail_rebuild1(t, db, δbtail, t0, t1, treeRoot, xverifyΔBTail_rebuild1(t, db, δbtail, t0, t1, treeRoot,
// after Update(t0->t1):
/*trackIdx=*/ ø,
// after Track(keys)
keys1, keys1,
/*trackIdx=*/ /*XXX temp*/nil /*Tadj(t1, keys1)*/, /*newTrackIdx=*/ xkv1.trackIdx(keys1),
// after rebuild
/*trackIdx=*/ xkv1.trackIdx(keys1),
/*vδB=*/ /*XXX temp*/nil /*[δ1/Tadj(keys1)*/) /*vδB=*/ /*XXX temp*/nil /*[δ1/Tadj(keys1)*/)
/* TODO reenable /* TODO reenable
// tRestKeys2 = tAllKeys - keys1 // tRestKeys2 = tAllKeys - keys1
tRestKeys2 := tAllKeys.Difference(keys1) tRestKeys2 := tAllKeys.Difference(keys1)
...@@ -847,16 +867,17 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1 ...@@ -847,16 +867,17 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
} }
} }
// xverifyΔBTail_rebuild1 verifies ΔBTree state after Update(ti->tj), Track(keys), rebuild // xverifyΔBTail_rebuild1 verifies ΔBTree state:
// 1. after Update(ti->tj),
// 2. after further Track(keys), rebuild
func xverifyΔBTail_rebuild1(t *testing.T, db *zodb.DB, δbtail *ΔBtail, ti, tj *tTreeCommit, treeRoot zodb.Oid, keys SetKey, trackIdxOK trackIndex, vδBok []ΔB) { func xverifyΔBTail_rebuild1(t *testing.T, db *zodb.DB, δbtail *ΔBtail, ti, tj *tTreeCommit, treeRoot zodb.Oid, keys SetKey, trackIdxOK trackIndex, vδBok []ΔB) {
X := exc.Raiseif X := exc.Raiseif
// XXX assert trackIdx=ø, newTrackIdx=ø, vδB=[]
// Update ati -> atj // Update ati -> atj
δB, err := δbtail.Update(tj.δZ); X(err) δB, err := δbtail.Update(tj.δZ); X(err)
// XXX assert δB.Rev = tj.at; δB = δ(ti,tj)/initially tracked // XXX assert δB.Rev = tj.at; δB = δ(ti,tj)/initially tracked
// XXX assert trackIdx=ø, newTrackIdx=ø, vδB=[ø] // XXX assertTrack(δbtail.trackIdx, ø)
// XXX assertTrack(δbtail.newTrackIdx, ø), vδB=[ø]
_ = δB _ = δB
// Track(keys) // Track(keys)
......
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