Commit caa0240f authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 9eef8bdd
......@@ -195,13 +195,6 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
}
zfile.PDeactivate()
// track zfile[-∞,∞) from the beginning
// this should make ΔFtail to see all zfile changes
size, path, err := zfile.Size(ctx); X(err)
δFtail.Track(zfile, /*blk*/-1, path, /*zblk*/nil)
if size != 0 {
t.Fatalf("BUG: zfile is not initially empty: size=%d", size)
}
// data built via applying changes from testv
vδf := []*ΔFile{} // (rev↑, {}blk)
......@@ -215,20 +208,27 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
dataTab[zblki.Name] = zblki.Data
}
xat := map[zodb.Tid]string{} // tid > "at<i>"
xat[δFtail.Head()] = "at0"
t.Logf("# @at0 (%s)", δFtail.Head())
// vector of epochs and func to create a new one
epochv := []zodb.Tid{0}
onNewEpoch := func(epoch zodb.Tid) {
epochv = append(epochv, epoch)
// track zfile[-∞,∞) from the beginning
// this should make ΔFtail to see all zfile changes
size, path, err := zfile.Size(ctx); X(err)
δFtail.Track(zfile, /*blk*/-1, path, /*zblk*/nil)
if size != 0 {
t.Fatalf("BUG: zfile is not initially empty: size=%d", size)
}
// retrack should be called after new epoch to track zfile[-∞,∞) again
retrack := func() {
for blk := range blkTab {
_, path, zblk, _, err := zfile.LoadBlk(ctx, blk); X(err)
δFtail.Track(zfile, blk, path, zblk)
}
}
xat := map[zodb.Tid]string{} // tid > "at<i>"
xat[δFtail.Head()] = "at0"
t.Logf("# @at0 (%s)", δFtail.Head())
epochv := []zodb.Tid{0}
// δfstr/vδfstr converts δf/vδf to string taking xat into account
δfstr := func(δf *ΔFile) string {
s := fmt.Sprintf("@%s·%s", xat[δf.Rev], δf.Blocks)
......@@ -325,6 +325,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
......@@ -369,9 +372,6 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
// update δFtail
δF, err := δFtail.Update(commit.ΔZ); X(err)
if newEpoch {
onNewEpoch(commit.At)
}
// assert δF points to the file if δfok != ø
if δF.Rev != commit.At {
......@@ -396,6 +396,11 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
t.Errorf("δf:\nhave: %v\nwant: %v", δf, δfok)
}
// track whole zfile again if new epoch was started
if newEpoch {
retrack()
}
// verify δFtail.trackSetZBlk
trackZinblk := map[string]setI64{}
for oid, zt := range δFtail.trackSetZBlk {
......
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