Commit a39d91af authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 4fe7b39c
......@@ -313,31 +313,49 @@ func (δTtail *ΔTtail) rebuild(δZtail *zodb.ΔTail, db *zodb.DB) (δtrackSet P
// go backwards and merge vδT <- treediff(lo..hi/trackNew)
vδZ := δZtail.Data()
// vδtrack := []*ΔPPTreeSubSet{}
for i := len(vδZ)-1; i>=0; i-- {
δZ := vδZ[i]
for {
δtkeycov := &RangedKeySet{} // all keys coming into tracking set during this lo..hi scan
trackNewCur := trackNew.Clone()
for i := len(vδZ)-1; i>=0; i-- {
δZ := vδZ[i]
// XXX dup wrt Update?
var atPrev zodb.Tid
if i > 0 {
atPrev = vδZ[i-1].Rev
} else {
atPrev = δZtail.Tail()
}
// XXX dup wrt Update?
δtrackNew, δtkeycov_, err := δTtail.rebuild1(atPrev, δZ, trackNewCur, db)
if err != nil {
return nil, err
}
var atPrev zodb.Tid
if i > 0 {
atPrev = vδZ[i-1].Rev
} else {
atPrev = δZtail.Tail()
trackNewCur.ApplyΔ(δtrackNew)
δtkeycov.UnionInplace(δtkeycov_)
// XXX update .KVAtTail, .lastRevOf
}
δtrackNew, δtkeycov, err := δTtail.rebuild1(atPrev, δZ, trackNew, db)
if err != nil {
return nil, err
// an iteration closer to tail may turn out to add a key to the tracking set
// we have to recheck all entries past that revision for changes to that key
// for example:
//
// XXX
//
// restart from head and cycle until set of tracked keys does not grow anymore
if δtkeycov.Empty() {
break
}
trackNew.ApplyΔ(δtrackNew)
// FIXME use δtkeycov to recompute track coverage
_ = δtkeycov
for _, r := δtkeycov.AllRanges() {
}
// XXX update .KVAtTail, .lastRevOf
}
/*
// trackNew was adjusted to correspond to @tail potentially growing its key coverage.
// Remap it back to @head and merge to .trackSet
......@@ -346,8 +364,9 @@ func (δTtail *ΔTtail) rebuild(δZtail *zodb.ΔTail, db *zodb.DB) (δtrackSet P
trackNew.ApplyΔ(δtrack)
}
δBtail.trackSet.UnionInplace(trackNew)
*/
return δtrackSet, nil
*/
return trackNew
}
// rebuild1 rebuilds δT for single δZ.
......
......@@ -160,7 +160,7 @@ func (δFtail *ΔFtail) Track(file *ZBigFile, blk int64, path []btree.LONode, zb
// XXX blk = ∞ from beginning ?
blk = xbtree.KeyMax
}
err := δFtail.δBtail.Track(blk, zblk != nil, path)
err := δFtail.δBtail.Track(blk, path)
if err != nil {
panic(err) // XXX -> error? errctx
}
......
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