Commit 59c83009 authored by Kirill Smelkov's avatar Kirill Smelkov

X ΔFtail.SliceByFileRoot tests started to work draftly after "on-the-fly" rework

parent 2e673d9f
...@@ -393,6 +393,7 @@ func (δFtail *ΔFtail) ForgetPast(revCut zodb.Tid) { ...@@ -393,6 +393,7 @@ func (δFtail *ΔFtail) ForgetPast(revCut zodb.Tid) {
// //
// 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 (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*readonly*/[]*ΔFile { func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*readonly*/[]*ΔFile {
//fmt.Printf("\n")
xtail.AssertSlice(δFtail, lo, hi) xtail.AssertSlice(δFtail, lo, hi)
// XXX locking // XXX locking
...@@ -456,7 +457,10 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado ...@@ -456,7 +457,10 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
} else { } else {
ZinblkAt = lo ZinblkAt = lo
} }
// it-- // XXX hack - should be in ΔBtail.SliceByRevRoot
if ZinblkAt <= lo {
it = -1 // don't go down beyond that
}
iz := len(vδZ) - 1 iz := len(vδZ) - 1
for (iz >= 0 || it >= 0) { for (iz >= 0 || it >= 0) {
...@@ -465,6 +469,7 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado ...@@ -465,6 +469,7 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
if iz >= 0 { if iz >= 0 {
δZ := vδZ[iz] δZ := vδZ[iz]
if ZinblkAt <= δZ.Rev { if ZinblkAt <= δZ.Rev {
//fmt.Printf("δZ @%s\n", δZ.Rev)
for _, oid := range δZ.Changev { for _, oid := range δZ.Changev {
inblk, ok := Zinblk[oid] inblk, ok := Zinblk[oid]
if ok && len(inblk) != 0 { if ok && len(inblk) != 0 {
...@@ -480,6 +485,7 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado ...@@ -480,6 +485,7 @@ func (δFtail *ΔFtail) SliceByFileRev(zfile *ZBigFile, lo, hi zodb.Tid) /*reado
// δT -> adjust Zinblk + update δf // δT -> adjust Zinblk + update δf
if it >= 0 { if it >= 0 {
δT := vδT[it] δT := vδT[it]
//fmt.Printf("δT @%s\n", δT.Rev)
for blk, δzblk := range δT.ΔKV { for blk, δzblk := range δT.ΔKV {
// apply in reverse as we go ← // apply in reverse as we go ←
if δzblk.New != xbtree.VDEL { if δzblk.New != xbtree.VDEL {
......
...@@ -308,8 +308,18 @@ func TestΔFtail(t *testing.T) { ...@@ -308,8 +308,18 @@ func TestΔFtail(t *testing.T) {
// XXX more // XXX more
// found by TestΔFtailRandom // ---- found by TestΔFtailRandom ----
{δT{1:a,6:i,7:d,8:e}, δD(a,c,e,f,g,h,i,j)}, {δT{1:a,6:i,7:d,8:e}, δD(a,c,e,f,g,h,i,j)},
// was including <= lo entries in SliceByFileRev
{δT{0:b,2:j,3:i,5:f,6:b,7:i,8:d}, δD(a,b,c,d,e,g,i,j)},
{δT{0:e,2:h,4:d,9:b}, δD(a,h,i)},
{δT{0:j,1:i,3:g,5:a,6:e,7:j,8:f,9:d}, δD()},
{δT{0:b,1:f,2:h,4:b,8:b}, δD(b,d,i)},
{δT{1:a,3:d,6:j}, δD(b,c,d,f,g,h,i,j)},
{δT{0:i,1:f,4:e,5:e,7:d,8:h}, δD(d,j)},
{δT{}, δD(a,b,c,e,f,g,h,i,j)},
} }
testq := make(chan ΔFTestEntry) testq := make(chan ΔFTestEntry)
......
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