Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
53571524
Commit
53571524
authored
Aug 06, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4f707117
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
6 deletions
+27
-6
wcfs/internal/zdata/δftail_test.go
wcfs/internal/zdata/δftail_test.go
+27
-6
No files found.
wcfs/internal/zdata/δftail_test.go
View file @
53571524
...
@@ -29,7 +29,7 @@ package zdata
...
@@ -29,7 +29,7 @@ package zdata
//
//
// Since ΔFtail does not recompute anything by itself when tracking set
// Since ΔFtail does not recompute anything by itself when tracking set
// changes, and only merges δBtail and δZtail histories on queries, there is no
// 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=[-∞,∞).
// ΔBtail works correctly and verify δFtail only with track=[-∞,∞).
//
//
// There are 2 testing approaches:
// There are 2 testing approaches:
...
@@ -40,6 +40,9 @@ package zdata
...
@@ -40,6 +40,9 @@ package zdata
// states and feed ΔFtail through created database transactions.
// states and feed ΔFtail through created database transactions.
//
//
// TestΔFtail and TestΔFtailRandom implement approaches "a" and "b" correspondingly.
// 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
(
import
(
"context"
"context"
...
@@ -604,8 +607,17 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
...
@@ -604,8 +607,17 @@ func testΔFtail(t_ *testing.T, testq chan ΔFTestEntry) {
}
}
}
}
// TestΔFtailXXX XXX.
// TestΔFtailSliceUntrackedUniform verifies that untracked blocks, if present, are present uniformly in returned slice.
func
TestΔFtailSliceXXX
(
t_
*
testing
.
T
)
{
//
// 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_
)
t
:=
xbtreetest
.
NewT
(
t_
)
X
:=
exc
.
Raiseif
X
:=
exc
.
Raiseif
...
@@ -614,6 +626,7 @@ func TestΔFtailSliceXXX(t_ *testing.T) {
...
@@ -614,6 +626,7 @@ func TestΔFtailSliceXXX(t_ *testing.T) {
xat
[
at0
]
=
"at0"
xat
[
at0
]
=
"at0"
δFtail
:=
NewΔFtail
(
at0
,
t
.
DB
)
δFtail
:=
NewΔFtail
(
at0
,
t
.
DB
)
// commit t1. 0 and 1 are in the same bucket.
t1
:=
t
.
CommitTree
(
"T/B0:a,1:b"
)
t1
:=
t
.
CommitTree
(
"T/B0:a,1:b"
)
xat
[
t1
.
At
]
=
"at1"
xat
[
t1
.
At
]
=
"at1"
δF
,
err
:=
δFtail
.
Update
(
t1
.
ΔZ
);
X
(
err
)
δF
,
err
:=
δFtail
.
Update
(
t1
.
ΔZ
);
X
(
err
)
...
@@ -668,21 +681,29 @@ func TestΔFtailSliceXXX(t_ *testing.T) {
...
@@ -668,21 +681,29 @@ func TestΔFtailSliceXXX(t_ *testing.T) {
return
fmt
.
Sprintf
(
"%s"
,
s
)
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
)
xtrackBlk
(
1
)
t2
:=
t
.
CommitTree
(
"t0:a,1:c Da:a
a,b:b,c:c"
)
// 1 -b+c, δa
t2
:=
t
.
CommitTree
(
"t0:a,1:c Da:a
2,b:b,c:c"
)
// 1: -b+c, δa₂
xat
[
t2
.
At
]
=
"at2"
xat
[
t2
.
At
]
=
"at2"
δF
,
err
=
δFtail
.
Update
(
t2
.
ΔZ
);
X
(
err
)
δ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
lo
:=
at0
hi
:=
t
2
.
At
hi
:=
t
3
.
At
vδf
:=
δFtail
.
SliceByFileRev
(
zfile
,
lo
,
hi
)
vδf
:=
δFtail
.
SliceByFileRev
(
zfile
,
lo
,
hi
)
_01
:=
setI64
{};
_01
.
Add
(
0
);
_01
.
Add
(
1
)
_01
:=
setI64
{};
_01
.
Add
(
0
);
_01
.
Add
(
1
)
vδf_ok
:=
[]
*
ΔFile
{
vδf_ok
:=
[]
*
ΔFile
{
&
ΔFile
{
Rev
:
t1
.
At
,
Blocks
:
_01
,
Size
:
true
},
&
ΔFile
{
Rev
:
t1
.
At
,
Blocks
:
_01
,
Size
:
true
},
&
ΔFile
{
Rev
:
t2
.
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
)
{
if
!
reflect
.
DeepEqual
(
vδf
,
vδf_ok
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment