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