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
b393f37f
Commit
b393f37f
authored
Jul 11, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
00b6ac98
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
55 deletions
+55
-55
wcfs/internal/xbtree/δbtail_test.go
wcfs/internal/xbtree/δbtail_test.go
+55
-55
No files found.
wcfs/internal/xbtree/δbtail_test.go
View file @
b393f37f
...
...
@@ -772,7 +772,7 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
// δT <- δB
δToid
:=
δB
.
ΔByRoot
[
treeRoot
]
// {} k -> δoid
δT
=
XG
etδKV
(
t1
,
t2
,
δToid
)
// {} k -> δ(ZBlk(oid).data)
δT
=
xg
etδKV
(
t1
,
t2
,
δToid
)
// {} k -> δ(ZBlk(oid).data)
// δT must be subset of d12.
// changed keys, that are
...
...
@@ -1030,7 +1030,7 @@ func xverifyΔBTail_rebuild_U(t *testing.T, δbtail *ΔBtail, treeRoot zodb.Oid,
}
δToid
,
ok
:=
δB
.
ΔByRoot
[
treeRoot
]
if
ok
{
δT
=
XG
etδKV
(
ti
,
tj
,
δToid
)
δT
=
xg
etδKV
(
ti
,
tj
,
δToid
)
}
if
δB
.
Rev
!=
tj
.
At
{
t
.
Errorf
(
"%s: δB.Rev: have %s ; want %s"
,
subj
,
δB
.
Rev
,
tj
.
At
)
...
...
@@ -1421,7 +1421,7 @@ func assertΔTtail(t *testing.T, subj string, δbtail *ΔBtail, tj *xbtreetest.C
atPrev
:=
t0
.
At
for
_
,
δToid
:=
range
vδToid
{
vat
=
append
(
vat
,
δToid
.
Rev
)
δT
:=
XG
etδKV
(
at2t
[
atPrev
],
at2t
[
δToid
.
Rev
],
δToid
.
ΔKV
)
// {} k -> δ(ZBlk(oid).data)
δT
:=
xg
etδKV
(
at2t
[
atPrev
],
at2t
[
δToid
.
Rev
],
δToid
.
ΔKV
)
// {} k -> δ(ZBlk(oid).data)
vδT
=
append
(
vδT
,
δT
)
atPrev
=
δToid
.
Rev
}
...
...
@@ -1463,56 +1463,6 @@ func assertΔTtail(t *testing.T, subj string, δbtail *ΔBtail, tj *xbtreetest.C
}
}
// xtrackKeys issues δbtail.Track requests for tree[keys].
func
xtrackKeys
(
δbtail
*
ΔBtail
,
t
*
xbtreetest
.
Commit
,
keys
setKey
)
{
X
:=
exc
.
Raiseif
head
:=
δbtail
.
Head
()
if
head
!=
t
.
At
{
panicf
(
"BUG: δbtail.head: %s ; t.at: %s"
,
head
,
t
.
At
)
}
for
k
:=
range
keys
{
// NOTE: if tree is deleted - the following adds it to tracked
// set with every key being a hole. This aligns with the
// following situation
//
// T1 -> ø -> T2
//
// where after T1->ø, even though the tree becomes deleted, its root
// continues to be tracked and all keys migrate to holes in the
// tracking set. By aligning initial state to the same as after
// T1->ø, we test what will happen on ø->T2.
b
:=
t
.
Xkv
.
Get
(
k
)
err
:=
δbtail
.
track
(
k
,
b
.
Path
());
X
(
err
)
}
}
// trackSet returns what should be ΔBtail.trackSet coverage for specified tracked key set.
func
trackSet
(
rbs
xbtreetest
.
RBucketSet
,
tracked
setKey
)
blib
.
PPTreeSubSet
{
// nil = don't compute keyCover
// (trackSet is called from inside hot inner loop of rebuild test)
return
_trackSetWithCov
(
rbs
,
tracked
,
nil
)
}
// trackSetWithCov returns what should be ΔBtail.trackSet and its key coverage for specified tracked key set.
func
trackSetWithCov
(
rbs
xbtreetest
.
RBucketSet
,
tracked
setKey
)
(
trackSet
blib
.
PPTreeSubSet
,
keyCover
*
blib
.
RangedKeySet
)
{
keyCover
=
&
blib
.
RangedKeySet
{}
trackSet
=
_trackSetWithCov
(
rbs
,
tracked
,
keyCover
)
return
trackSet
,
keyCover
}
func
_trackSetWithCov
(
rbs
xbtreetest
.
RBucketSet
,
tracked
setKey
,
outKeyCover
*
blib
.
RangedKeySet
)
(
trackSet
blib
.
PPTreeSubSet
)
{
trackSet
=
blib
.
PPTreeSubSet
{}
for
k
:=
range
tracked
{
kb
:=
rbs
.
Get
(
k
)
if
outKeyCover
!=
nil
{
outKeyCover
.
AddRange
(
kb
.
Keycov
)
}
trackSet
.
AddPath
(
kb
.
Path
())
}
return
trackSet
}
// assertTrack verifies state of .trackSet and ΔTtail.trackNew.
// 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
)
{
...
...
@@ -1556,10 +1506,60 @@ func (δBtail *ΔBtail) assertTrack(t *testing.T, subj string, trackSetOK blib.P
}
}
// trackSet returns what should be ΔBtail.trackSet coverage for specified tracked key set.
func
trackSet
(
rbs
xbtreetest
.
RBucketSet
,
tracked
setKey
)
blib
.
PPTreeSubSet
{
// nil = don't compute keyCover
// (trackSet is called from inside hot inner loop of rebuild test)
return
_trackSetWithCov
(
rbs
,
tracked
,
nil
)
}
// trackSetWithCov returns what should be ΔBtail.trackSet and its key coverage for specified tracked key set.
func
trackSetWithCov
(
rbs
xbtreetest
.
RBucketSet
,
tracked
setKey
)
(
trackSet
blib
.
PPTreeSubSet
,
keyCover
*
blib
.
RangedKeySet
)
{
keyCover
=
&
blib
.
RangedKeySet
{}
trackSet
=
_trackSetWithCov
(
rbs
,
tracked
,
keyCover
)
return
trackSet
,
keyCover
}
func
_trackSetWithCov
(
rbs
xbtreetest
.
RBucketSet
,
tracked
setKey
,
outKeyCover
*
blib
.
RangedKeySet
)
(
trackSet
blib
.
PPTreeSubSet
)
{
trackSet
=
blib
.
PPTreeSubSet
{}
for
k
:=
range
tracked
{
kb
:=
rbs
.
Get
(
k
)
if
outKeyCover
!=
nil
{
outKeyCover
.
AddRange
(
kb
.
Keycov
)
}
trackSet
.
AddPath
(
kb
.
Path
())
}
return
trackSet
}
// xtrackKeys issues δbtail.Track requests for tree[keys].
func
xtrackKeys
(
δbtail
*
ΔBtail
,
t
*
xbtreetest
.
Commit
,
keys
setKey
)
{
X
:=
exc
.
Raiseif
head
:=
δbtail
.
Head
()
if
head
!=
t
.
At
{
panicf
(
"BUG: δbtail.head: %s ; t.at: %s"
,
head
,
t
.
At
)
}
for
k
:=
range
keys
{
// NOTE: if tree is deleted - the following adds it to tracked
// set with every key being a hole. This aligns with the
// following situation
//
// T1 -> ø -> T2
//
// where after T1->ø, even though the tree becomes deleted, its root
// continues to be tracked and all keys migrate to holes in the
// tracking set. By aligning initial state to the same as after
// T1->ø, we test what will happen on ø->T2.
b
:=
t
.
Xkv
.
Get
(
k
)
err
:=
δbtail
.
track
(
k
,
b
.
Path
());
X
(
err
)
}
}
//
XG
etδKV translates {k -> δ<oid>} to {k -> δ(ZBlk(oid).data)} according to t1..t2 db snapshots.
func
XG
etδKV
(
t1
,
t2
*
xbtreetest
.
Commit
,
δkvOid
map
[
Key
]
ΔValue
)
map
[
Key
]
Δstring
{
//
xg
etδKV translates {k -> δ<oid>} to {k -> δ(ZBlk(oid).data)} according to t1..t2 db snapshots.
func
xg
etδKV
(
t1
,
t2
*
xbtreetest
.
Commit
,
δkvOid
map
[
Key
]
ΔValue
)
map
[
Key
]
Δstring
{
δkv
:=
make
(
map
[
Key
]
Δstring
,
len
(
δkvOid
))
for
k
,
δvOid
:=
range
δkvOid
{
δkv
[
k
]
=
Δstring
{
...
...
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