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
2f9a46eb
Commit
2f9a46eb
authored
Jun 21, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
69449694
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
26 deletions
+56
-26
wcfs/internal/xbtree/δbtail_test.go
wcfs/internal/xbtree/δbtail_test.go
+56
-26
No files found.
wcfs/internal/xbtree/δbtail_test.go
View file @
2f9a46eb
...
...
@@ -966,7 +966,7 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
fmt
.
Printf
(
"@%s: %v
\n
"
,
xat
[
t1
.
at
],
t1
.
xkv
.
Flatten
())
fmt
.
Printf
(
"@%s: %v
\n
"
,
xat
[
t2
.
at
],
t2
.
xkv
.
Flatten
())
kadj01
:=
KAdj
(
t0
,
t1
,
allTestKeys
(
t0
,
t1
,
t2
))
//
kadj01 := KAdj(t0,t1, allTestKeys(t0,t1,t2))
kadj10
:=
KAdj
(
t1
,
t0
,
allTestKeys
(
t0
,
t1
,
t2
))
kadj21
:=
KAdj
(
t2
,
t1
,
allTestKeys
(
t0
,
t1
,
t2
))
kadj12
:=
KAdj
(
t1
,
t2
,
allTestKeys
(
t0
,
t1
,
t2
))
...
...
@@ -1011,11 +1011,38 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
/*vδT=*/
δkv1_1
)
t
.
Run
((
" →"
+
t2
.
tree
),
func
(
t
*
testing
.
T
)
{
// tracked keys1 becomes tracked keys1_2 after Update(t1->t2)
// keys1_2 := kadj12.Map(keys1)
keys1_2
:=
kadj12
.
Map
(
kadj01
.
Map
(
keys1_0
))
xverifyΔBTail_rebuild_U
(
t
,
δbtail
,
db
,
treeRoot
,
t1
,
t2
,
xat
,
/*trackSet=*/
t2
.
xkv
.
trackSet
(
keys1_2
))
// XXX +vδT=δkv1_2, δkv2_2
// keys1R2 is full set of keys that should become tracked after
// Update() (which includes rebuild)
keys1R2
:=
kadj12
.
Map
(
keys1
)
for
{
keys1R2_
:=
kadj10
.
Map
(
kadj21
.
Map
(
keys1R2
))
if
keys1R2
.
Equal
(
keys1R2_
)
{
break
}
keys1R2
=
keys1R2_
}
// δkvX_k1R2 = tX.δxkv / keys1R2
δkv1_k1R2
:=
map
[
Key
]
Δstring
{}
δkv2_k1R2
:=
map
[
Key
]
Δstring
{}
for
k
:=
range
keys1R2
{
δv1
,
ok
:=
t1
.
δxkv
[
k
]
if
ok
{
δkv1_k1R2
[
k
]
=
δv1
}
δv2
,
ok
:=
t2
.
δxkv
[
k
]
if
ok
{
δkv2_k1R2
[
k
]
=
δv2
}
}
// // tracked keys1 becomes tracked keys1_2 after Update(t1->t2)
//// keys1_2 := kadj12.Map(keys1)
// keys1_2 := kadj12.Map(kadj01.Map(keys1_0))
xverifyΔBTail_rebuild_U
(
t
,
δbtail
,
db
,
treeRoot
,
t1
,
t2
,
xat
,
// /*trackSet=*/t2.xkv.trackSet(keys1_2),
/*trackSet=*/
t2
.
xkv
.
trackSet
(
keys1R2
),
/*vδT=*/
δkv1_k1R2
,
δkv2_k1R2
)
// tRestKeys2 = tAllKeys - keys1
tRestKeys2
:=
tAllKeys
.
Difference
(
keys1
)
...
...
@@ -1026,43 +1053,44 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
keys2
.
Add
(
tRestKeyv2
[
idx2
])
}
//
find out
full set of keys that should become tracked after
//
keys12R2 is
full set of keys that should become tracked after
// Track(keys2) + rebuild
keys12R
:=
keys1_
2
.
Union
(
keys2
)
keys12R
2
:=
keys1R
2
.
Union
(
keys2
)
for
{
keys12R
_
:=
kadj10
.
Map
(
kadj21
.
Map
(
keys12R
))
if
keys12R
.
Equal
(
keys12R
_
)
{
keys12R
2_
:=
kadj10
.
Map
(
kadj21
.
Map
(
keys12R2
))
if
keys12R
2
.
Equal
(
keys12R2
_
)
{
break
}
keys12R
=
keys12R
_
keys12R
2
=
keys12R2
_
}
// δkv1_2 = t1.δxkv / kadj10(kadj21(kadj12(keys1) | keys2))
// δkv2_2 = t2.δxkv / kadj10(kadj21(kadj12(keys1) | keys2))
// keys12_2 := keys1_2.Union(keys2)
// keys12_0 := kadj10.Map(kadj21.Map(keys12_2))
//
// δkv1_2 = t1.δxkv / kadj10(kadj21(kadj12(keys1) | keys2))
//
// δkv2_2 = t2.δxkv / kadj10(kadj21(kadj12(keys1) | keys2))
//
//
keys12_2 := keys1_2.Union(keys2)
//
//
keys12_0 := kadj10.Map(kadj21.Map(keys12_2))
fmt
.
Printf
(
"
\n\n\n
KKK
\n
keys1=%s keys2=%s
\n
"
,
keys1
,
keys2
)
fmt
.
Printf
(
"keys12R
=%s
\n
"
,
keys12R
)
fmt
.
Printf
(
"keys12R
2=%s
\n
"
,
keys12R2
)
fmt
.
Printf
(
"t0.xkv: %v
\n
"
,
t0
.
xkv
)
fmt
.
Printf
(
"t1.xkv: %v
\n
"
,
t1
.
xkv
)
fmt
.
Printf
(
"t2.xkv: %v
\n
"
,
t2
.
xkv
)
fmt
.
Printf
(
"kadj21: %v
\n
"
,
kadj21
)
fmt
.
Printf
(
"kadj12: %v
\n
"
,
kadj12
)
fmt
.
Printf
(
"t2.xkv.trackSet(%s) -> %s"
,
keys12R
,
t2
.
xkv
.
trackSet
(
keys12R
))
fmt
.
Printf
(
"t2.xkv.trackSet(%s) -> %s"
,
keys12R
2
,
t2
.
xkv
.
trackSet
(
keys12R2
))
fmt
.
Printf
(
"
\n\n\n
"
)
δkv1_2
:=
map
[
Key
]
Δstring
{}
δkv2_2
:=
map
[
Key
]
Δstring
{}
for
k
:=
range
keys12R
{
// δkvX_k12R2 = tX.δxkv / keys12R2
δkv1_k12R2
:=
map
[
Key
]
Δstring
{}
δkv2_k12R2
:=
map
[
Key
]
Δstring
{}
for
k
:=
range
keys12R2
{
δv1
,
ok
:=
t1
.
δxkv
[
k
]
if
ok
{
δkv1_2
[
k
]
=
δv1
δkv1_
k12R
2
[
k
]
=
δv1
}
δv2
,
ok
:=
t2
.
δxkv
[
k
]
if
ok
{
δkv2_2
[
k
]
=
δv2
δkv2_
k12R
2
[
k
]
=
δv2
}
}
...
...
@@ -1072,15 +1100,17 @@ func xverifyΔBTail_rebuild(t *testing.T, db *zodb.DB, treeRoot zodb.Oid, t0, t1
xverifyΔBTail_rebuild_TR
(
t
,
db
,
δbtail_
,
t2
,
treeRoot
,
xat
,
// after Track(keys2)
keys2
,
/*trackSet*/
t2
.
xkv
.
trackSet
(
keys1_2
),
// /*trackSet*/ t2.xkv.trackSet(keys1_2),
/*trackSet*/
t2
.
xkv
.
trackSet
(
keys1R2
),
/*trackNew*/
t2
.
xkv
.
trackSet
(
keys2
)
.
Difference
(
// trackNew should not cover ranges that are
// already in trackSet
t2
.
xkv
.
trackSet
(
keys1_2
)),
// t2.xkv.trackSet(keys1_2)),
t2
.
xkv
.
trackSet
(
keys1R2
)),
// after rebuild
/* trackSet=*/
t2
.
xkv
.
trackSet
(
keys12R
),
/*vδT=*/
δkv1_
2
,
δkv2_
2
)
/* trackSet=*/
t2
.
xkv
.
trackSet
(
keys12R
2
),
/*vδT=*/
δkv1_
k12R2
,
δkv2_k12R
2
)
// })
}
})
...
...
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