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
6c0c6755
Commit
6c0c6755
authored
Jun 21, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
364c2727
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
2 deletions
+63
-2
wcfs/internal/xbtree/δbtail_test.go
wcfs/internal/xbtree/δbtail_test.go
+63
-2
No files found.
wcfs/internal/xbtree/δbtail_test.go
View file @
6c0c6755
...
@@ -645,6 +645,11 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
...
@@ -645,6 +645,11 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
// xverifyΔBTail_Update verifies how ΔBTail handles ZODB update for a tree with changes in between t1->t2.
// xverifyΔBTail_Update verifies how ΔBTail handles ZODB update for a tree with changes in between t1->t2.
//
// Note: this test verifies only single treediff step of ΔBtail.Update.
// the cycling phase of update, that is responsible to recompute older
// entries when key coverage grows, is exercised by
// xverifyΔBTail_rebuild.
func
xverifyΔBTail_Update
(
t
*
testing
.
T
,
subj
string
,
db
*
zodb
.
DB
,
treeRoot
zodb
.
Oid
,
t1
,
t2
*
tTreeCommit
)
{
func
xverifyΔBTail_Update
(
t
*
testing
.
T
,
subj
string
,
db
*
zodb
.
DB
,
treeRoot
zodb
.
Oid
,
t1
,
t2
*
tTreeCommit
)
{
// verify transition at1->at2 for all initial states of tracked {keys} from kv1 + kv2 + ∞
// verify transition at1->at2 for all initial states of tracked {keys} from kv1 + kv2 + ∞
...
@@ -995,6 +1000,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
...
@@ -995,6 +1000,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
δbtail
.
assertTrack
(
t
,
"@at0"
,
ø
,
ø
)
// XXX + vδB
δbtail
.
assertTrack
(
t
,
"@at0"
,
ø
,
ø
)
// XXX + vδB
xverifyΔBTail_rebuild_U
(
t
,
δbtail
,
t0
,
t1
,
xat
,
/*trackSet=*/
ø
)
xverifyΔBTail_rebuild_U
(
t
,
δbtail
,
t0
,
t1
,
xat
,
/*trackSet=*/
ø
)
// XXX ^^^ + vδT=ø
xverifyΔBTail_rebuild_TR
(
t
,
db
,
δbtail
,
t1
,
treeRoot
,
xat
,
xverifyΔBTail_rebuild_TR
(
t
,
db
,
δbtail
,
t1
,
treeRoot
,
xat
,
// after Track(keys1)
// after Track(keys1)
keys1
,
keys1
,
...
@@ -1010,6 +1016,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
...
@@ -1010,6 +1016,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
// keys1_2 := kadj12.Map(keys1)
// keys1_2 := kadj12.Map(keys1)
keys1_2
:=
kadj12
.
Map
(
kadj01
.
Map
(
keys1_0
))
keys1_2
:=
kadj12
.
Map
(
kadj01
.
Map
(
keys1_0
))
xverifyΔBTail_rebuild_U
(
t
,
δbtail
,
t1
,
t2
,
xat
,
/*trackSet=*/
t2
.
xkv
.
trackSet
(
keys1_2
))
xverifyΔBTail_rebuild_U
(
t
,
δbtail
,
t1
,
t2
,
xat
,
/*trackSet=*/
t2
.
xkv
.
trackSet
(
keys1_2
))
// XXX +vδT=δkv1_2, δkv2_2
// tRestKeys2 = tAllKeys - keys1
// tRestKeys2 = tAllKeys - keys1
tRestKeys2
:=
tAllKeys
.
Difference
(
keys1
)
tRestKeys2
:=
tAllKeys
.
Difference
(
keys1
)
...
@@ -1084,7 +1091,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
...
@@ -1084,7 +1091,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
}
}
// xverifyΔBTail_rebuild_U verifies ΔBTree state after Update(ti->tj).
// xverifyΔBTail_rebuild_U verifies ΔBTree state after Update(ti->tj).
func
xverifyΔBTail_rebuild_U
(
t
*
testing
.
T
,
δbtail
*
ΔBtail
,
ti
,
tj
*
tTreeCommit
,
xat
map
[
zodb
.
Tid
]
string
,
trackSet
PPTreeSubSet
)
{
func
xverifyΔBTail_rebuild_U
(
t
*
testing
.
T
,
δbtail
*
ΔBtail
,
ti
,
tj
*
tTreeCommit
,
xat
map
[
zodb
.
Tid
]
string
,
trackSet
PPTreeSubSet
,
vδTok
...
map
[
Key
]
Δstring
)
{
t
.
Helper
()
t
.
Helper
()
X
:=
exc
.
Raiseif
X
:=
exc
.
Raiseif
ø
:=
PPTreeSubSet
{}
ø
:=
PPTreeSubSet
{}
...
@@ -1097,7 +1104,7 @@ func xverifyΔBTail_rebuild_U(t *testing.T, δbtail *ΔBtail, ti, tj *tTreeCommi
...
@@ -1097,7 +1104,7 @@ func xverifyΔBTail_rebuild_U(t *testing.T, δbtail *ΔBtail, ti, tj *tTreeCommi
}
}
// xverifyΔBTail_rebuild_TR verifies ΔBTree state after Track(keys) + rebuild.
// xverifyΔBTail_rebuild_TR verifies ΔBTree state after Track(keys) + rebuild.
func
xverifyΔBTail_rebuild_TR
(
t
*
testing
.
T
,
db
*
zodb
.
DB
,
δbtail
*
ΔBtail
,
tj
*
tTreeCommit
,
treeRoot
zodb
.
Oid
,
xat
map
[
zodb
.
Tid
]
string
,
keys
SetKey
,
trackSet
PPTreeSubSet
,
trackNew
,
trackSetAfterRebuild
PPTreeSubSet
,
vδTok
...
map
[
Key
]
Δstring
)
{
func
xverifyΔBTail_rebuild_TR
(
t
*
testing
.
T
,
db
*
zodb
.
DB
,
δbtail
*
ΔBtail
,
tj
*
tTreeCommit
,
treeRoot
zodb
.
Oid
,
xat
map
[
zodb
.
Tid
]
string
,
keys
SetKey
,
trackSet
PPTreeSubSet
,
trackNew
,
trackSetAfterRebuild
PPTreeSubSet
,
vδTok
...
map
[
Key
]
Δstring
)
{
t
.
Helper
()
t
.
Helper
()
X
:=
exc
.
Raiseif
X
:=
exc
.
Raiseif
ø
:=
PPTreeSubSet
{}
ø
:=
PPTreeSubSet
{}
...
@@ -1123,6 +1130,10 @@ func xverifyΔBTail_rebuild_TR(t *testing.T, db *zodb.DB, δbtail *ΔBtail, tj *
...
@@ -1123,6 +1130,10 @@ func xverifyΔBTail_rebuild_TR(t *testing.T, db *zodb.DB, δbtail *ΔBtail, tj *
// XXX verify Get
// XXX verify Get
// verify δbtail.vδTbyRoot[treeRoot]
xverifyΔTtail
(
t
,
fmt
.
Sprintf
(
"@%s: after Track%v + rebuild"
,
xat
[
tj
.
at
],
keys
),
db
,
δbtail
,
tj
,
treeRoot
,
xat
,
vδTok
...
)
/*
// verify SliceByRootRev XXX -> verify δbtail.byRoot[treeRoot] directly
// verify SliceByRootRev XXX -> verify δbtail.byRoot[treeRoot] directly
// XXX +KVAtTail, +lastRevOf
// XXX +KVAtTail, +lastRevOf
l := len(vδTok)
l := len(vδTok)
...
@@ -1164,6 +1175,56 @@ func xverifyΔBTail_rebuild_TR(t *testing.T, db *zodb.DB, δbtail *ΔBtail, tj *
...
@@ -1164,6 +1175,56 @@ func xverifyΔBTail_rebuild_TR(t *testing.T, db *zodb.DB, δbtail *ΔBtail, tj *
}
}
t.Errorf("@%s: after Track%v + rebuild: SliceByRootRev:\nhave: %v\nwant: %v", xat[tj.at], keys, have, want)
t.Errorf("@%s: after Track%v + rebuild: SliceByRootRev:\nhave: %v\nwant: %v", xat[tj.at], keys, have, want)
}
}
*/
}
// xverifyΔTtail verifies state of ΔTtail that corresponds to treeRoot in δbtail.
func
xverifyΔTtail
(
t
*
testing
.
T
,
subj
string
,
db
*
zodb
.
DB
,
δbtail
*
ΔBtail
,
tj
*
tTreeCommit
,
treeRoot
zodb
.
Oid
,
xat
map
[
zodb
.
Tid
]
string
,
vδTok
...
map
[
Key
]
Δstring
)
{
t
.
Helper
()
// XXX +KVAtTail, +lastRevOf
l
:=
len
(
vδTok
)
vatOK
:=
[]
zodb
.
Tid
{}
vδTok_
:=
[]
map
[
Key
]
Δstring
{}
t0
:=
tj
for
i
:=
0
;
i
<
l
;
i
++
{
// empty vδTok entries means they should be absent in vδT
if
δTok
:=
vδTok
[
l
-
i
-
1
];
len
(
δTok
)
!=
0
{
vatOK
=
append
([]
zodb
.
Tid
{
t0
.
at
},
vatOK
...
)
vδTok_
=
append
([]
map
[
Key
]
Δstring
{
δTok
},
vδTok_
...
)
}
t0
=
t0
.
prev
}
vδTok
=
vδTok_
// lo := t0.at
// hi := tj.at
// vδToid := δbtail.SliceByRootRev(treeRoot, lo, hi)
δTtail
:=
δbtail
.
vδTbyRoot
[
treeRoot
]
vδToid
:=
δTtail
.
vδT
l
=
len
(
vδToid
)
vat
:=
make
([]
zodb
.
Tid
,
l
)
vδT
:=
[]
map
[
Key
]
Δstring
{}
// atPrev := lo
atPrev
:=
t0
.
at
for
i
,
δToid
:=
range
vδToid
{
vat
[
i
]
=
δToid
.
Rev
δT
:=
XGetδKV
(
db
,
atPrev
,
δToid
.
Rev
,
δToid
.
ΔKV
)
// {} k -> δ(ZBlk(oid).data)
vδT
=
append
(
vδT
,
δT
)
atPrev
=
δToid
.
Rev
}
if
!
(
reflect
.
DeepEqual
(
vat
,
vatOK
)
&&
reflect
.
DeepEqual
(
vδT
,
vδTok
))
{
have
:=
""
for
i
:=
0
;
i
<
len
(
vδT
);
i
++
{
have
+=
fmt
.
Sprintf
(
"
\n\t
@%s: %v"
,
xat
[
vat
[
i
]],
vδT
[
i
])
}
want
:=
""
for
i
:=
0
;
i
<
len
(
vδTok
);
i
++
{
want
+=
fmt
.
Sprintf
(
"
\n\t
@%s: %v"
,
xat
[
vatOK
[
i
]],
vδTok
[
i
])
}
t
.
Errorf
(
"%s: vδT:
\n
have: %v
\n
want: %v"
,
subj
,
have
,
want
)
}
}
}
// xverifyΔBTail_GetAt verifies δBtail.Get on series of vt ZODB changes.
// xverifyΔBTail_GetAt verifies δBtail.Get on series of vt ZODB changes.
...
...
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