Commit aa0288ce authored by Kirill Smelkov's avatar Kirill Smelkov

X Switch SliceByRootRev to vδTSnapForTracked

Triggered one bug in ΔFtail.SliceByFileRev which was not checking
file's root to be VDEL.
parent d6aae7ec
......@@ -1320,21 +1320,23 @@ func (δBtail *ΔBtail) GetAt(root zodb.Oid, key Key, at zodb.Tid) (value Value,
// Only tracked keys are guaranteed to be present.
//
// Note: contrary to regular go slicing, low is exclusive while high is inclusive.
func (δBtail *ΔBtail) SliceByRootRev(root zodb.Oid, lo, hi zodb.Tid) /*readonly*/[]ΔTree {
func (δBtail *ΔBtail) SliceByRootRev(root zodb.Oid, lo, hi zodb.Tid) (/*readonly*/vδT []ΔTree) {
xtail.AssertSlice(δBtail, lo, hi)
// XXX locking
err := δBtail.rebuild1IfNeeded(root)
if err != nil {
panic(err) // XXX
if traceΔBtail {
tracefΔBtail("\nSlice root<%s> (@%s,@%s]\n", root, lo, hi)
defer func() {
tracefΔBtail("-> vδT(lo,hi]: %v\n", vδT)
}()
}
δTtail, ok := δBtail.byRoot[root]
if !ok {
return []ΔTree{} // XXX -> panic (root must be tracked)
// retrieve vδT snapshot that is rebuilt to take all previous Track requests
vδT, err := δBtail.vδTSnapForTracked(root)
if err != nil {
panic(err) // XXX
}
debugfΔBtail(" vδT: %v\n", vδT)
vδT := δTtail.vδT
l := len(vδT)
if l == 0 {
return nil
......
......@@ -684,7 +684,10 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
//fmt.Printf("Zinblk: %v\n", Zinblk)
// vδT for current epoch
vδT := δFtail.δBtail.SliceByRootRev(root, epoch, head) // NOTE @head, not hi
var vδT []xbtree.ΔTree
if root != xbtree.VDEL {
vδT = δFtail.δBtail.SliceByRootRev(root, epoch, head) // NOTE @head, not hi
}
it := len(vδT) - 1
if it >= 0 {
ZinblkAt = vδT[it].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