Commit d0481d4c authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 77c4efc7
......@@ -308,7 +308,7 @@ func (δBtail *ΔBtail) Head() zodb.Tid { return δBtail.δZtail.Head() }
func (δBtail *ΔBtail) Tail() zodb.Tid { return δBtail.δZtail.Tail() }
// ---- Track/rebuild/Update/Forget ----
// ---- Track/snapshot+rebuild/Update/Forget ----
// Track adds tree path to tracked set.
//
......@@ -388,7 +388,7 @@ func (δBtail *ΔBtail) track(path []zodb.Oid, keycov KeyRange) {
tracefΔBtail("->T: nop\n")
path_ := δBtail.trackSet.Path(leaf)
if !pathEqual(path, path_) {
panicf("BUG: keyrange %s is already tracked via path=%v\ntrack requests path=%v", keycov, path_, path)
panicf("BUG: keycov %s is already tracked via path=%v\ntrack requests path=%v", keycov, path_, path)
}
return
}
......@@ -404,7 +404,7 @@ func (δBtail *ΔBtail) track(path []zodb.Oid, keycov KeyRange) {
tracefΔBtail("->T: nop\n")
path_ := δTtail.trackNew.Path(leaf)
if !pathEqual(path, path_) {
panicf("BUG: keyrange %s is already in trackNew via path=%v\ntrack requests path=%v", keycov, path_, path)
panicf("BUG: keycov %s is already in trackNew via path=%v\ntrack requests path=%v", keycov, path_, path)
}
return
}
......@@ -417,27 +417,6 @@ func (δBtail *ΔBtail) track(path []zodb.Oid, keycov KeyRange) {
tracefΔBtail("->T: [%s].ktrackNew -> %s\n", root, δTtail.ktrackNew)
}
// rebuildAll rebuilds ΔBtail taking all trackNew requests into account.
// XXX inline into _Update1 ?
func (δBtail *ΔBtail) rebuildAll() (err error) {
defer xerr.Context(&err, "ΔBtail rebuildAll")
// XXX locking correct?
δBtail.mu.Lock()
defer δBtail.mu.Unlock()
tracefΔBtail("\nRebuildAll @%s..@%s trackNewRoots: %s\n", δBtail.Tail(), δBtail.Head(), δBtail.trackNewRoots)
for root := range δBtail.trackNewRoots {
δTtail := δBtail.byRoot[root] // must be there
err = δTtail._runRebuildJob(root, δBtail)
if err != nil {
return err
}
}
return nil
}
// vδTSnapForTrackedKey returns vδT snapshot for root that takes into account
// at least all previous Track requests related to key.
//
......@@ -588,7 +567,6 @@ func (δTtail *_ΔTtail) _runRebuildJob(root zodb.Oid, δBtail *ΔBtail) (err er
return err
}
// Update updates δB with object-level ZODB changes.
//
// Only those objects from δZ that belong to tracked set are guaranteed to be
......@@ -733,6 +711,26 @@ func (δBtail *ΔBtail) _Update1(δZ *zodb.EventCommit) (δB1 _ΔBUpdate1, err e
return δB1, nil
}
// rebuildAll rebuilds ΔBtail taking all trackNew requests into account.
func (δBtail *ΔBtail) rebuildAll() (err error) {
defer xerr.Context(&err, "ΔBtail rebuildAll")
// XXX locking correct?
δBtail.mu.Lock()
defer δBtail.mu.Unlock()
tracefΔBtail("\nRebuildAll @%s..@%s trackNewRoots: %s\n", δBtail.Tail(), δBtail.Head(), δBtail.trackNewRoots)
for root := range δBtail.trackNewRoots {
δTtail := δBtail.byRoot[root] // must be there
err = δTtail._runRebuildJob(root, δBtail)
if err != nil {
return err
}
}
return nil
}
// _vδBroots_Update updates .vδBroots to remember that _ΔTtail for root has
// changed entries with δrevSet revisions.
//
......@@ -953,7 +951,7 @@ func (δBtail *ΔBtail) SliceByRootRev(root zodb.Oid, lo, hi zodb.Tid) (/*readon
}
// ---- vδTBuild/vδTMerge ----
// ---- vδTBuild/vδTMerge (rebuild core) ----
// vδTBuild builds vδT from vδZ for root/tracked=trackNew.
//
......
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