Commit 8402f4c3 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c34907cf
......@@ -59,7 +59,6 @@ type PPTreeSubSet map[zodb.Oid]*nodeInTree
type nodeInTree struct {
parent zodb.Oid // parent node | InvalidOid for root
nchild int // number of direct children in PPTreeSubSet referring to this node
// XXX + [lo,hi) range this node is coming under in its parent XXX -> in its tree ?
}
// Has returns whether node is in the set.
......@@ -155,7 +154,7 @@ func normPath(path []zodb.Oid) []zodb.Oid {
return path
}
// ---- Union/Difference/Intersetctior ----
// ---- Union/Difference/Intersection ----
// Union returns U = PP(A.leafs | B.leafs)
//
......@@ -212,7 +211,7 @@ func (A PPTreeSubSet) DifferenceInplace(B PPTreeSubSet) {
A.xDifferenceInplace(B)
}
// XXX Intersection
// TODO Intersection
func (A PPTreeSubSet) xUnionInplace(B PPTreeSubSet) {
if tracePPSet {
......@@ -333,7 +332,6 @@ func (S PPTreeSubSet) gc1(oid zodb.Oid) {
for oid != zodb.InvalidOid {
t := S[oid]
t.nchild--
// if t.nchild > 0 || /* root node */t.parent == zodb.InvalidOid {
if t.nchild > 0 {
break
}
......
......@@ -88,6 +88,7 @@ func TestPPTreeSubSetOps(t *testing.T) {
S{}), // D
}
// assert1 asserts that result of op(A,B) == resOK.
assert1 := func(op string, A, B, res, resOK S) {
t.Helper()
if res.Equal(resOK) {
......
......@@ -576,7 +576,7 @@ ABcov:
}
// {} oid -> nodeInRange for all nodes we've came through in Bv:
// current and previously expanded - up till top B
// current and previously expanded - up till top B.
BnodeIdx := map[zodb.Oid]*nodeInRange{}
if !Bempty {
BnodeIdx[ABoid] = btop
......@@ -590,7 +590,7 @@ ABcov:
// by default a node contributes to δ-
// a node ac does not contribute to δ- and can be skipped, if:
// - ac is not tracked, or
// - ac ∉ δZTC && ∃ bc from B: ac.oid == bc.oid && ac.keyrange == bc.keyrange
// - ac ∉ δZTC && ∃ bc from B: ac.oid == bc.oid && ac.keycov == bc.keycov
// (ac+ac.children were not changed, ac stays in the tree with the same key range coverage)
Aq := []*nodeInRange{atop} // queue for A nodes that contribute to δ-
for len(Aq) > 0 {
......
......@@ -33,10 +33,6 @@ import (
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xtail"
)
// XXX malfancitioning rebuild currently breaks wcfs tests
// TODO kill this after rebuild is finished
const XXX_killWhenRebuildWorks = true
const traceΔBtail = false
const debugΔBtail = false
......@@ -271,7 +267,7 @@ func (δBtail *ΔBtail) track(key Key, path []zodb.Oid) error {
// XXX locking
// first normalize path: remove embedded bucket and check if it was an
// empty artificial tree. We need to do the normalization becase we
// empty artificial tree. We need to do the normalization because we
// later check whether leaf path[-1] ∈ trackSet and without
// normalization path[-1] can be InvalidOid.
path = normPath(path)
......@@ -375,10 +371,17 @@ func (δTtail *ΔTtail) rebuild(root zodb.Oid, δZtail *zodb.ΔTail, db *zodb.DB
}
// an iteration closer to tail may turn out to add a key to the tracking set.
// We have to recheck all entries newer that revision for changes to that key
// We have to recheck all entries newer that revision for changes to that key,
// for example:
//
// XXX
// 8 5*
// / \ <- / \
// 2 8 2* 7
//
// here initial tracked set is 5*-2*. Going to earlier revision
// 2'th keycov range is widen from [-∞,5) to [-∞,7), so 5*-7 in
// later revision have to be rechecked because 7 was added into
// tracking set.
//
// Implement this via restarting from head and cycling until
// set of tracked keys does not grow anymore.
......@@ -602,22 +605,11 @@ func (δBtail *ΔBtail) _Update1(δZ *zodb.EventCommit) (δB1 _ΔBUpdate1, err e
δB1 = _ΔBUpdate1{ByRoot: make(map[zodb.Oid]*_ΔTUpdate1)}
if XXX_killWhenRebuildWorks {
// XXX hack - until vvv is reenabled
for root := range δBtail.trackNewRoots {
δTtail := δBtail.vδTbyRoot[root] // must succeed
δBtail.trackSet.UnionInplace(δTtail.trackNew)
δTtail.trackNew = PPTreeSubSet{}
}
δBtail.trackNewRoots = SetOid{}
} else {
// XXX reenable (currently breaks wcfs tests)
// update .trackSet and vδB from .trackNew
err = δBtail.rebuildAll()
if err != nil {
return δB1, err
}
}
// XXX dup wrt rebuild?
......@@ -666,7 +658,7 @@ if XXX_killWhenRebuildWorks {
func (δBtail *ΔBtail) ForgetPast(revCut zodb.Tid) {
δBtail.δZtail.ForgetPast(revCut) // XXX stub
// TODO go throough vδBroots till revcut -> find which trees to trim -> trim ΔTtails.
// TODO go through vδBroots till revcut -> find which trees to trim -> trim ΔTtails.
panic("TODO")
}
......
......@@ -1154,9 +1154,6 @@ func assertΔTtail(t *testing.T, subj string, δbtail *ΔBtail, db *zodb.DB, tj
t0 = t0.prev
}
vδTok = vδTok_
// lo := t0.at
// hi := tj.at
// vδToid := δbtail.SliceByRootRev(treeRoot, lo, hi)
δTtail, ok := δbtail.vδTbyRoot[treeRoot]
var vδToid []ΔTree
if ok {
......@@ -1166,7 +1163,6 @@ func assertΔTtail(t *testing.T, subj string, δbtail *ΔBtail, db *zodb.DB, tj
l = len(vδToid)
var vat []zodb.Tid
var vδT []map[Key]Δstring
// atPrev := lo
atPrev := t0.at
for _, δToid := range vδToid {
vat = append(vat, δToid.Rev)
......
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