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, ...@@ -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. // Only tracked keys are guaranteed to be present.
// //
// Note: contrary to regular go slicing, low is exclusive while high is inclusive. // 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) xtail.AssertSlice(δBtail, lo, hi)
// XXX locking
err := δBtail.rebuild1IfNeeded(root) if traceΔBtail {
if err != nil { tracefΔBtail("\nSlice root<%s> (@%s,@%s]\n", root, lo, hi)
panic(err) // XXX defer func() {
tracefΔBtail("-> vδT(lo,hi]: %v\n", vδT)
}()
} }
δTtail, ok := δBtail.byRoot[root] // retrieve vδT snapshot that is rebuilt to take all previous Track requests
if !ok { vδT, err := δBtail.vδTSnapForTracked(root)
return []ΔTree{} // XXX -> panic (root must be tracked) if err != nil {
panic(err) // XXX
} }
debugfΔBtail(" vδT: %v\n", vδT)
vδT := δTtail.vδT
l := len(vδT) l := len(vδT)
if l == 0 { if l == 0 {
return nil return nil
......
...@@ -684,7 +684,10 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado ...@@ -684,7 +684,10 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
//fmt.Printf("Zinblk: %v\n", Zinblk) //fmt.Printf("Zinblk: %v\n", Zinblk)
// vδT for current epoch // 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 it := len(vδT) - 1
if it >= 0 { if it >= 0 {
ZinblkAt = vδT[it].Rev 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