Commit 6b2c1d79 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 1ba21b2c
......@@ -241,6 +241,7 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
i := 0
delfilePrev := false
epochv := []zodb.Tid{0}
for test := range testq {
i++
δblk := setI64{}
......@@ -252,11 +253,11 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
delfile = true
}
epoch := delfile || (!delfile && delfilePrev && !delfilePrev)
newEpoch := delfile || (!delfile && delfilePrev && !delfilePrev)
delfilePrev = delfile
// epoch -> reset
if epoch {
// newEpoch -> reset
if newEpoch {
blkTab = map[int64]string{}
Zinblk = map[string]setI64{}
δblk = nil
......@@ -315,6 +316,9 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
req = tTxt + " " + dTxt
}
commit := t.CommitTree(req)
if newEpoch {
epochv = append(epochv, commit.At)
}
// update blkRevAt
var blkRevPrev map[int64]zodb.Tid
......@@ -323,7 +327,7 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
}
blkRev := map[int64]zodb.Tid{}
for blk, rev := range blkRevPrev {
if epoch {
if newEpoch {
blkRev[blk] = commit.At
} else {
blkRev[blk] = rev
......@@ -340,10 +344,10 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
err = zconn.Resync(ctx, commit.At); X(err)
var δfok *ΔFile
if epoch || len(δblk) != 0 {
if newEpoch || len(δblk) != 0 {
δfok = &ΔFile{
Rev: commit.At,
Epoch: epoch,
Epoch: newEpoch,
Blocks: δblk,
Size: δtree, // not strictly ok, but matches current ΔFtail code
}
......@@ -454,7 +458,17 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
blkRev := blkRevAt[at]
for _, blk := range blkv {
rev, exact := δftail.LastBlkRev(ctx, zfile, blk, at)
revOK, exactOK := blkRev[blk], true
revOK, ok := blkRev[blk]
if !ok {
k := len(epochv) - 1
for ; k >= 0; k-- {
if epochv[k] <= at {
break
}
}
revOK = epochv[k]
}
exactOK := true
if revOK <= δftail.Tail() {
revOK, exactOK = δftail.Tail(), false
}
......
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