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
c4366b14
Commit
c4366b14
authored
Oct 11, 2021
by
Kirill Smelkov
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X xbtree: tests: Also verify state of ΔTtail.ktrackNew
parent
98fe9f1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
19 deletions
+36
-19
wcfs/internal/xbtree/δbtail_test.go
wcfs/internal/xbtree/δbtail_test.go
+36
-19
No files found.
wcfs/internal/xbtree/δbtail_test.go
View file @
c4366b14
...
@@ -703,7 +703,8 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
...
@@ -703,7 +703,8 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
}
}
}
}
ø
:=
blib
.
PPTreeSubSet
{}
ø
:=
blib
.
PPTreeSubSet
{}
kø
:=
&
blib
.
RangedKeySet
{}
// trackSet1 = xkv1[tracked1]
// trackSet1 = xkv1[tracked1]
// trackSet2 = xkv2[tracked2] ( = xkv2[kadj[tracked1]]
// trackSet2 = xkv2[tracked2] ( = xkv2[kadj[tracked1]]
...
@@ -711,7 +712,7 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
...
@@ -711,7 +712,7 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
trackSet2
,
tkeyCov2
:=
trackSetWithCov
(
t2
.
Xkv
,
initialTrackedKeys
.
Union
(
kadjTrackedδZ
))
trackSet2
,
tkeyCov2
:=
trackSetWithCov
(
t2
.
Xkv
,
initialTrackedKeys
.
Union
(
kadjTrackedδZ
))
// verify δbtail.trackSet against @at1
// verify δbtail.trackSet against @at1
δbtail
.
assertTrack
(
t
,
"1"
,
ø
,
trackSet1
)
δbtail
.
assertTrack
(
t
,
"1"
,
ø
,
trackSet1
,
tkeyCov1
)
// δB <- δZ
// δB <- δZ
//
//
...
@@ -756,7 +757,7 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
...
@@ -756,7 +757,7 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
}
}
// verify δbtail.trackSet against @at2
// verify δbtail.trackSet against @at2
δbtail
.
assertTrack
(
t
,
"2"
,
trackSet2
,
ø
)
δbtail
.
assertTrack
(
t
,
"2"
,
trackSet2
,
ø
,
kø
)
// assert δB.ByRoot == {treeRoot -> ...} if δTok != ø
// assert δB.ByRoot == {treeRoot -> ...} if δTok != ø
...
@@ -838,7 +839,8 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
...
@@ -838,7 +839,8 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
// kadj210 = kadj10·kadj21
// kadj210 = kadj10·kadj21
kadj210
:=
kadj10
.
Mul
(
kadj21
)
kadj210
:=
kadj10
.
Mul
(
kadj21
)
ø
:=
blib
.
PPTreeSubSet
{}
ø
:=
blib
.
PPTreeSubSet
{}
kø
:=
&
blib
.
RangedKeySet
{}
// verify t0 -> t1 Track(keys1) Rebuild -> t2 Track(keys2) Rebuild
// verify t0 -> t1 Track(keys1) Rebuild -> t2 Track(keys2) Rebuild
// for all combinations of keys1 and keys2
// for all combinations of keys1 and keys2
...
@@ -858,14 +860,14 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
...
@@ -858,14 +860,14 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
}
}
}
}
Tkeys1
:=
trackSet
(
t1
.
Xkv
,
keys1
)
Tkeys1
,
kTkeys1
:=
trackSetWithCov
(
t1
.
Xkv
,
keys1
)
Tkeys1_0
:=
trackSet
(
t1
.
Xkv
,
keys1_0
)
Tkeys1_0
:=
trackSet
(
t1
.
Xkv
,
keys1_0
)
t
.
Run
(
fmt
.
Sprintf
(
" T%s;R"
,
keys1
),
func
(
t
*
testing
.
T
)
{
t
.
Run
(
fmt
.
Sprintf
(
" T%s;R"
,
keys1
),
func
(
t
*
testing
.
T
)
{
δbtail
:=
NewΔBtail
(
t0
.
At
,
db
)
δbtail
:=
NewΔBtail
(
t0
.
At
,
db
)
// assert trackSet=ø, trackNew=ø, vδB=[]
// assert trackSet=ø, trackNew=ø, vδB=[]
δbtail
.
assertTrack
(
t
,
"@at0"
,
ø
,
ø
)
δbtail
.
assertTrack
(
t
,
"@at0"
,
ø
,
ø
,
kø
)
assertΔTtail
(
t
,
"@at0"
,
δbtail
,
t0
,
treeRoot
,
assertΔTtail
(
t
,
"@at0"
,
δbtail
,
t0
,
treeRoot
,
/*vδT=ø*/
)
/*vδT=ø*/
)
...
@@ -875,8 +877,9 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
...
@@ -875,8 +877,9 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
xverifyΔBTail_rebuild_TR
(
t
,
δbtail
,
t1
,
treeRoot
,
xverifyΔBTail_rebuild_TR
(
t
,
δbtail
,
t1
,
treeRoot
,
// after Track(keys1)
// after Track(keys1)
keys1
,
keys1
,
/*trackSet=*/
ø
,
/*trackSet=*/
ø
,
/*trackNew=*/
Tkeys1
,
/*trackNew=*/
Tkeys1
,
/*ktrackNew=*/
kTkeys1
,
// after rebuild
// after rebuild
/*trackSet=*/
Tkeys1_0
,
/*trackSet=*/
Tkeys1_0
,
...
@@ -908,7 +911,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
...
@@ -908,7 +911,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
}
}
}
}
Tkeys1R2
:=
trackSet
(
t2
.
Xkv
,
keys1R2
)
Tkeys1R2
,
kTkeys1R2
:=
trackSetWithCov
(
t2
.
Xkv
,
keys1R2
)
xverifyΔBTail_rebuild_U
(
t
,
δbtail
,
treeRoot
,
t1
,
t2
,
xverifyΔBTail_rebuild_U
(
t
,
δbtail
,
treeRoot
,
t1
,
t2
,
/*trackSet=*/
Tkeys1R2
,
/*trackSet=*/
Tkeys1R2
,
...
@@ -943,8 +946,8 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
...
@@ -943,8 +946,8 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
keys12R2
=
keys12R2_
keys12R2
=
keys12R2_
}
}
Tkeys2
:=
trackSet
(
t2
.
Xkv
,
keys2
)
Tkeys2
,
kTkeys2
:=
trackSetWithCov
(
t2
.
Xkv
,
keys2
)
Tkeys12R2
:=
trackSet
(
t2
.
Xkv
,
keys12R2
)
Tkeys12R2
:=
trackSet
(
t2
.
Xkv
,
keys12R2
)
/*
/*
fmt.Printf("\n\n\nKKK\nkeys1=%s keys2=%s\n", keys1, keys2)
fmt.Printf("\n\n\nKKK\nkeys1=%s keys2=%s\n", keys1, keys2)
fmt.Printf("keys1R2: %s\n", keys1R2)
fmt.Printf("keys1R2: %s\n", keys1R2)
...
@@ -987,6 +990,9 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
...
@@ -987,6 +990,9 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
// trackNew should not cover ranges that are
// trackNew should not cover ranges that are
// already in trackSet
// already in trackSet
Tkeys1R2
),
Tkeys1R2
),
/*ktrackNew*/
kTkeys2
.
Difference
(
// see ^^^ about trackNew
kTkeys1R2
),
// after rebuild
// after rebuild
/* trackSet=*/
Tkeys12R2
,
/* trackSet=*/
Tkeys12R2
,
...
@@ -1004,12 +1010,13 @@ func xverifyΔBTail_rebuild_U(t *testing.T, δbtail *ΔBtail, treeRoot zodb.Oid,
...
@@ -1004,12 +1010,13 @@ func xverifyΔBTail_rebuild_U(t *testing.T, δbtail *ΔBtail, treeRoot zodb.Oid,
t
.
Helper
()
t
.
Helper
()
X
:=
exc
.
Raiseif
X
:=
exc
.
Raiseif
ø
:=
blib
.
PPTreeSubSet
{}
ø
:=
blib
.
PPTreeSubSet
{}
kø
:=
&
blib
.
RangedKeySet
{}
subj
:=
fmt
.
Sprintf
(
"after Update(@%s→@%s)"
,
ti
.
AtSymb
(),
tj
.
AtSymb
())
subj
:=
fmt
.
Sprintf
(
"after Update(@%s→@%s)"
,
ti
.
AtSymb
(),
tj
.
AtSymb
())
// Update ati -> atj
// Update ati -> atj
δB
,
err
:=
δbtail
.
Update
(
tj
.
ΔZ
);
X
(
err
)
δB
,
err
:=
δbtail
.
Update
(
tj
.
ΔZ
);
X
(
err
)
δbtail
.
assertTrack
(
t
,
subj
,
trackSet
,
ø
)
δbtail
.
assertTrack
(
t
,
subj
,
trackSet
,
ø
,
kø
)
assertΔTtail
(
t
,
subj
,
δbtail
,
tj
,
treeRoot
,
vδTok
...
)
assertΔTtail
(
t
,
subj
,
δbtail
,
tj
,
treeRoot
,
vδTok
...
)
// assert δB = vδTok[-1]
// assert δB = vδTok[-1]
...
@@ -1045,20 +1052,21 @@ func xverifyΔBTail_rebuild_U(t *testing.T, δbtail *ΔBtail, treeRoot zodb.Oid,
...
@@ -1045,20 +1052,21 @@ func xverifyΔBTail_rebuild_U(t *testing.T, δbtail *ΔBtail, treeRoot zodb.Oid,
}
}
// xverifyΔBTail_rebuild_TR verifies ΔBtail state after Track(keys) + rebuild.
// xverifyΔBTail_rebuild_TR verifies ΔBtail state after Track(keys) + rebuild.
func
xverifyΔBTail_rebuild_TR
(
t
*
testing
.
T
,
δbtail
*
ΔBtail
,
tj
*
xbtreetest
.
Commit
,
treeRoot
zodb
.
Oid
,
keys
setKey
,
trackSet
blib
.
PPTreeSubSet
,
trackNew
,
trackSetAfterRebuild
blib
.
PPTreeSubSet
,
vδTok
...
map
[
Key
]
Δstring
)
{
func
xverifyΔBTail_rebuild_TR
(
t
*
testing
.
T
,
δbtail
*
ΔBtail
,
tj
*
xbtreetest
.
Commit
,
treeRoot
zodb
.
Oid
,
keys
setKey
,
trackSet
,
trackNew
blib
.
PPTreeSubSet
,
ktrackNew
*
blib
.
RangedKeySet
,
trackSetAfterRebuild
blib
.
PPTreeSubSet
,
vδTok
...
map
[
Key
]
Δstring
)
{
t
.
Helper
()
t
.
Helper
()
ø
:=
blib
.
PPTreeSubSet
{}
ø
:=
blib
.
PPTreeSubSet
{}
kø
:=
&
blib
.
RangedKeySet
{}
// Track(keys)
// Track(keys)
trackKeys
(
δbtail
,
tj
,
keys
)
trackKeys
(
δbtail
,
tj
,
keys
)
subj
:=
fmt
.
Sprintf
(
"@%s: after Track%v"
,
tj
.
AtSymb
(),
keys
)
subj
:=
fmt
.
Sprintf
(
"@%s: after Track%v"
,
tj
.
AtSymb
(),
keys
)
δbtail
.
assertTrack
(
t
,
subj
,
trackSet
,
trackNew
)
δbtail
.
assertTrack
(
t
,
subj
,
trackSet
,
trackNew
,
ktrackNew
)
δbtail
.
_rebuildAll
()
δbtail
.
_rebuildAll
()
subj
+=
" + rebuild"
subj
+=
" + rebuild"
δbtail
.
assertTrack
(
t
,
subj
,
trackSetAfterRebuild
,
ø
)
δbtail
.
assertTrack
(
t
,
subj
,
trackSetAfterRebuild
,
ø
,
kø
)
// verify δbtail.byRoot[treeRoot]
// verify δbtail.byRoot[treeRoot]
assertΔTtail
(
t
,
subj
,
δbtail
,
tj
,
treeRoot
,
vδTok
...
)
assertΔTtail
(
t
,
subj
,
δbtail
,
tj
,
treeRoot
,
vδTok
...
)
...
@@ -1679,9 +1687,9 @@ func assertΔTtail(t *testing.T, subj string, δbtail *ΔBtail, tj *xbtreetest.C
...
@@ -1679,9 +1687,9 @@ func assertΔTtail(t *testing.T, subj string, δbtail *ΔBtail, tj *xbtreetest.C
}
}
}
}
// assertTrack verifies state of .trackSet and ΔTtail.
trackNew. XXX and .ktrackNew
// assertTrack verifies state of .trackSet and ΔTtail.
(k)trackNew.
// it assumes that only one tree root is being tracked.
// it assumes that only one tree root is being tracked.
func
(
δBtail
*
ΔBtail
)
assertTrack
(
t
*
testing
.
T
,
subj
string
,
trackSetOK
blib
.
PPTreeSubSet
,
trackNewOK
blib
.
PPTreeSubSet
)
{
func
(
δBtail
*
ΔBtail
)
assertTrack
(
t
*
testing
.
T
,
subj
string
,
trackSetOK
blib
.
PPTreeSubSet
,
trackNewOK
blib
.
PPTreeSubSet
,
ktrackNewOK
*
blib
.
RangedKeySet
)
{
t
.
Helper
()
t
.
Helper
()
if
!
δBtail
.
trackSet
.
Equal
(
trackSetOK
)
{
if
!
δBtail
.
trackSet
.
Equal
(
trackSetOK
)
{
t
.
Errorf
(
"%s: trackSet:
\n\t
have: %v
\n\t
want: %v"
,
subj
,
δBtail
.
trackSet
,
trackSetOK
)
t
.
Errorf
(
"%s: trackSet:
\n\t
have: %v
\n\t
want: %v"
,
subj
,
δBtail
.
trackSet
,
trackSetOK
)
...
@@ -1692,8 +1700,14 @@ func (δBtail *ΔBtail) assertTrack(t *testing.T, subj string, trackSetOK blib.P
...
@@ -1692,8 +1700,14 @@ func (δBtail *ΔBtail) assertTrack(t *testing.T, subj string, trackSetOK blib.P
roots
.
Add
(
root
)
roots
.
Add
(
root
)
}
}
tEmpty
:=
trackNewOK
.
Empty
()
kEmpty
:=
ktrackNewOK
.
Empty
()
if
tEmpty
!=
kEmpty
{
t
.
Errorf
(
"BUG: %s: empty(trackNewOK) != empty(ktrackNewOK)"
,
subj
)
return
}
nrootsOK
:=
1
nrootsOK
:=
1
if
trackSetOK
.
Empty
()
&&
t
rackNewOK
.
Empty
()
{
if
trackSetOK
.
Empty
()
&&
t
Empty
{
nrootsOK
=
0
nrootsOK
=
0
}
}
if
len
(
roots
)
!=
nrootsOK
{
if
len
(
roots
)
!=
nrootsOK
{
...
@@ -1720,6 +1734,9 @@ func (δBtail *ΔBtail) assertTrack(t *testing.T, subj string, trackSetOK blib.P
...
@@ -1720,6 +1734,9 @@ func (δBtail *ΔBtail) assertTrack(t *testing.T, subj string, trackSetOK blib.P
if
!
δTtail
.
trackNew
.
Equal
(
trackNewOK
)
{
if
!
δTtail
.
trackNew
.
Equal
(
trackNewOK
)
{
t
.
Errorf
(
"%s: vδT.trackNew:
\n\t
have: %v
\n\t
want: %v"
,
subj
,
δTtail
.
trackNew
,
trackNewOK
)
t
.
Errorf
(
"%s: vδT.trackNew:
\n\t
have: %v
\n\t
want: %v"
,
subj
,
δTtail
.
trackNew
,
trackNewOK
)
}
}
if
!
δTtail
.
ktrackNew
.
Equal
(
ktrackNewOK
)
{
t
.
Errorf
(
"%s: vδT.ktrackNew:
\n\t
have: %v
\n\t
want: %v"
,
subj
,
δTtail
.
ktrackNew
,
ktrackNewOK
)
}
}
}
// trackSet returns what should be ΔBtail.trackSet coverage for specified tracked key set.
// trackSet returns what should be ΔBtail.trackSet coverage for specified tracked key set.
...
...
Kirill Smelkov
@kirr
mentioned in commit
305d897b
·
Oct 27, 2021
mentioned in commit
305d897b
mentioned in commit 305d897b15ac0866de464de36b34c1fe1de90a63
Toggle commit list
Kirill Smelkov
@kirr
mentioned in commit
2ab4be93
·
Oct 28, 2021
mentioned in commit
2ab4be93
mentioned in commit 2ab4be938541c61bf881216bdffc5376241ccc30
Toggle commit list
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