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