Commit e09b503e authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 2f9a46eb
......@@ -329,8 +329,8 @@ func (δTtail *ΔTtail) rebuild(root zodb.Oid, δZtail *zodb.ΔTail, db *zodb.DB
// go backwards and merge vδT <- treediff(lo..hi/trackNew)
vδZ := δZtail.Data()
for {
δtkeycov := &RangedKeySet{} // all keys coming into tracking set during this lo..hi scan
trackNewCur := trackNew.Clone() // trackNew adjusted when going to i<- entry
δtkeycov := &RangedKeySet{} // all keys coming into tracking set during this lo<-hi scan
trackNewCur := trackNew.Clone() // trackNew adjusted as of when going to i<- entry
for i := len(vδZ)-1; i>=0; i-- {
δZ := vδZ[i]
......@@ -576,27 +576,36 @@ if XXX_killWhenRebuildWorks {
tracefΔBtail("\n-> root<%s> δkv: %v δtrack: %v δtkeycov: %v\n", root, δT, δtrack, δtkeycov)
δTtail := δBtail.vδTbyRoot[root] // must be there
if len(δT) > 0 { // an object might be resaved without change
δB.ΔByRoot[root] = δT
δTtail, ok := δBtail.vδTbyRoot[root]
if !ok {
// XXX should not happen (only roots requested to be present are present in δ)
// this root was not tracked before -> create δTtail for it with empty changes
δTtail = newΔTtail()
δBtail.vδTbyRoot[root] = δTtail
}
δB.ΔByRoot[root] = δT // XXX after rebuild
δTtail.vδT = append(δTtail.vδT, ΔTree{Rev: δZ.Tid, ΔKV: δT})
// XXX rebuild KVAtTail
// XXX rebuild lastRevOf
}
δBtail.trackSet.ApplyΔ(δtrack)
δTKeyCov.ByRoot[root] = δtkeycov
// XXX if δtkeycov != ø && len(δZtail) > 1 -> rebuild δTtail
// XXX do this
// δtkeycov != ø -> rebuild δTtail
//
// XXX NOTE `len(δZtail) > 1` check is not only optimization - it is
// important for tests: xverifyΔBTail_Update calls ΔBtail._Update with
// only one revision inside δZtail, and this way also directly exercises
// treediff. Should we drop `len(δZtail) > 1` check here, that test will
// no longer directly exercise treediff behaviour.
if !δtkeycov.Empty() && δBtail.δZtail.Len() > 1 {
δTtail.trackNew = ... // ~δtkeycov
δtrackSet, err := δTtail.rebuild(root, δBtail.δZtail, δBtail.db)
if err != nil {
return ΔB{}, δTKeyCov, err
}
δBtail.trackSet.UnionInplace(δtrackSet)
// XXX Update δTKeyCov? XXX or it is needed only to be returned
// from treediff?
}
δTKeyCov.ByRoot[root] = δtkeycov // XXX after rebuild
// XXX rebuild KVAtTail
// XXX rebuild lastRevOf
}
return δB, δTKeyCov, nil
......@@ -610,11 +619,6 @@ func (δBtail *ΔBtail) ForgetPast(revCut zodb.Tid) {
}
// update brings .δBtail up to date by recomputing diff XXX and taking new
// entries in .δZtail into account.
// func (δBtail *ΔBtail) update() XXX kill
// Get returns root[key] as of @at database state plus revision that changed it.
//
// if revExact=False - rev is upper estimate for the revision.
......
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