Commit 53571524 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 4f707117
......@@ -29,7 +29,7 @@ package zdata
//
// Since ΔFtail does not recompute anything by itself when tracking set
// changes, and only merges δBtail and δZtail histories on queries, there is no
// need to exercise many different tracking sets. Once again we assume that
// need to exercise many different tracking sets(*). Once again we assume that
// ΔBtail works correctly and verify δFtail only with track=[-∞,∞).
//
// There are 2 testing approaches:
......@@ -40,6 +40,9 @@ package zdata
// states and feed ΔFtail through created database transactions.
//
// TestΔFtail and TestΔFtailRandom implement approaches "a" and "b" correspondingly.
//
// (*) except one small place in SliceByFileRev which handles tracked vs
// untracked set differences and is verified by TestΔFtailSliceUntrackedUniform.
import (
"context"
......@@ -604,8 +607,17 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
}
}
// TestΔFtailXXX XXX.
func TestΔFtailSliceXXX(t_ *testing.T) {
// TestΔFtailSliceUntrackedUniform verifies that untracked blocks, if present, are present uniformly in returned slice.
//
// Some changes to untracked blocks, might be seen by ΔFtail, because those
// changes occur in the same BTree bucket that covers another change to a
// tracked block.
//
// Here we verify that if some change to such untracked block is ever present,
// SliceByFileRev returns all changes to that untracked block. In other words
// we verify that no change to untracked block is missed, if any change to that
// block is ever present in returned slice.
func TestΔFtailSliceUntrackedUniform(t_ *testing.T) {
t := xbtreetest.NewT(t_)
X := exc.Raiseif
......@@ -614,6 +626,7 @@ func TestΔFtailSliceXXX(t_ *testing.T) {
xat[at0] = "at0"
δFtail := NewΔFtail(at0, t.DB)
// commit t1. 0 and 1 are in the same bucket.
t1 := t.CommitTree("T/B0:a,1:b")
xat[t1.At] = "at1"
δF, err := δFtail.Update(t1.ΔZ); X(err)
......@@ -668,21 +681,29 @@ func TestΔFtailSliceXXX(t_ *testing.T) {
return fmt.Sprintf("%s", s)
}
// XXX explain
// track 1, but do not track 0.
// blktab[0] becomes tracked by δBtail because both 0 and 1 are in the same bucket.
xtrackBlk(1)
t2 := t.CommitTree("t0:a,1:c Da:aa,b:b,c:c") // 1 -b+c, δa
t2 := t.CommitTree("t0:a,1:c Da:a2,b:b,c:c") // 1: -b+c, δa₂
xat[t2.At] = "at2"
δF, err = δFtail.Update(t2.ΔZ); X(err)
// XXX assert δF
t3 := t.CommitTree("t0:a,1:c Da:a3,b:b,c:c") // δa₃
xat[t3.At] = "at3"
δF, err = δFtail.Update(t3.ΔZ); X(err)
// XXX assert δF
lo := at0
hi := t2.At
hi := t3.At
vδf := δFtail.SliceByFileRev(zfile, lo, hi)
_01 := setI64{}; _01.Add(0); _01.Add(1)
vδf_ok := []*ΔFile{
&ΔFile{Rev: t1.At, Blocks: _01, Size: true},
&ΔFile{Rev: t2.At, Blocks: _01, Size: true},
&ΔFile{Rev: t3.At, Blocks: _01, Size: false},
}
if !reflect.DeepEqual(vδf, vδf_ok) {
......
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