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
f01f7677
Commit
f01f7677
authored
Jun 14, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
5aac8b0d
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
15 deletions
+56
-15
wcfs/internal/xbtree/pptreesubset.go
wcfs/internal/xbtree/pptreesubset.go
+5
-0
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+0
-0
wcfs/internal/xbtree/δbtail_test.go
wcfs/internal/xbtree/δbtail_test.go
+50
-14
wcfs/internal/zdata/δftail.go
wcfs/internal/zdata/δftail.go
+1
-1
No files found.
wcfs/internal/xbtree/pptreesubset.go
View file @
f01f7677
...
...
@@ -395,6 +395,11 @@ func (A PPTreeSubSet) Equal(B PPTreeSubSet) bool {
return
true
}
// Empty returns whether set is empty.
func
(
S
PPTreeSubSet
)
Empty
()
bool
{
return
len
(
S
)
==
0
}
func
(
t
nodeInTree
)
String
()
string
{
return
fmt
.
Sprintf
(
"{p%s c%d}"
,
t
.
parent
,
t
.
nchild
)
}
...
...
wcfs/internal/xbtree/δbtail.go
View file @
f01f7677
This diff is collapsed.
Click to expand it.
wcfs/internal/xbtree/δbtail_test.go
View file @
f01f7677
...
...
@@ -690,7 +690,7 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
badv
=
append
(
badv
,
fmt
.
Sprintf
(
format
,
argv
...
))
}
defer
func
()
{
if
badv
!=
nil
{
if
badv
!=
nil
||
t
.
Failed
()
{
emsg
:=
fmt
.
Sprintf
(
"%s ; tracked=%v :
\n\n
"
,
subj
,
initialTrackedKeys
)
emsg
+=
fmt
.
Sprintf
(
"d12: %v
\n
δTok: %v
\n
δT: %v
\n\n
"
,
d12
,
δTok
,
δT
)
emsg
+=
fmt
.
Sprintf
(
"δZ: %v
\n
"
,
δZset
)
...
...
@@ -789,13 +789,15 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
// verify δbtail.trackSet against @at1
// trackSet1 = xkv1[tracked1]
trackSet1
,
tkeyCov1
:=
xkv1
.
trackSetWithCov
(
initialTrackedKeys
)
/*
if !δbtail.trackSet.Equal(ø) {
badf("δbtail.trackSet1 wrong:\n\thave: %v\n\twant: %v", δbtail.trackSet, ø)
}
if !δbtail.trackNew.Equal(trackSet1) {
badf("δbtail.trackNew1 wrong:\n\thave: %v\n\twant: %v", δbtail.trackNew, trackSet1)
}
// δbtail.assertTrack(t, "1", ø, trackSet1)
*/
δbtail
.
assertTrack
(
t
,
"1"
,
ø
,
trackSet1
)
// δB <- δZ
...
...
@@ -808,13 +810,15 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
// verify δbtail.trackSet against @at2
// trackSet2 = xkv2[tracked2] ( = xkv2[kadj[tracked1]]
trackSet2
,
tkeyCov2
:=
xkv2
.
trackSetWithCov
(
initialTrackedKeys
.
Union
(
kadjTrackedδZ
))
/*
if !δbtail.trackSet.Equal(trackSet2) {
badf("δbtail.trackSet2 wrong:\n\thave: %v\n\twant: %v", δbtail.trackSet, trackSet2)
}
if !δbtail.trackNew.Equal(ø) {
badf("δbtail.trackNew2 wrong:\n\thave: %v\n\twant: %v", δbtail.trackNew, ø)
}
// δbtail.assertTrack(t, "2", trackSet2, ø)
*/
δbtail
.
assertTrack
(
t
,
"2"
,
trackSet2
,
ø
)
// assert δB.ByRoot == {treeRoot -> ...} if δTok != ø
...
...
@@ -824,13 +828,13 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
rootsOK
.
Add
(
treeRoot
)
}
roots
:=
SetOid
{}
for
root
:=
range
δB
.
ByRoot
{
for
root
:=
range
δB
.
Δ
ByRoot
{
roots
.
Add
(
root
)
}
if
!
reflect
.
DeepEqual
(
roots
,
rootsOK
)
{
badf
(
"δB: roots != rootsOK ; roots=%v rootsOK=%v"
,
roots
,
rootsOK
)
}
_
,
inδB
:=
δB
.
ByRoot
[
treeRoot
]
_
,
inδB
:=
δB
.
Δ
ByRoot
[
treeRoot
]
if
!
inδB
{
return
}
...
...
@@ -844,7 +848,7 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
// δT <- δB
δToid
:=
δB
.
ByRoot
[
treeRoot
]
// {} k -> δoid
δToid
:=
δB
.
ΔByRoot
[
treeRoot
]
// {} k -> δoid
δT
=
XGetδKV
(
db
,
at1
,
at2
,
δToid
)
// {} k -> δ(ZBlk(oid).data)
// δT must be subset of d12.
...
...
@@ -883,20 +887,52 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
// assertTrack verifies that trackSet == trackSetOK.
// XXX place
func
assertTrack
(
t
*
testing
.
T
,
subj
string
,
trackSet
,
trackSetOK
PPTreeSubSet
)
{
// XXX inline into δbtail.assertTrack?
func
_assertTrack
(
t
*
testing
.
T
,
subj
string
,
trackSet
,
trackSetOK
PPTreeSubSet
)
{
t
.
Helper
()
eq
:=
trackSet
.
Equal
(
trackSetOK
)
if
!
eq
{
if
!
trackSet
.
Equal
(
trackSetOK
)
{
t
.
Errorf
(
"%s:
\n\t
have: %v
\n\t
want: %v"
,
subj
,
trackSet
,
trackSetOK
)
}
}
// assertTrack verifies state of .trackSet and .trackNew.
// assertTrack verifies state of .trackSet and ΔTtail.trackNew.
// it assumes that only one tree root is being tracked.
// XXX place
func
(
δ
btail
*
ΔBtail
)
assertTrack
(
t
*
testing
.
T
,
subj
string
,
trackSetOK
,
trackNewOK
PPTreeSubSet
)
{
func
(
δ
Btail
*
ΔBtail
)
assertTrack
(
t
*
testing
.
T
,
subj
string
,
trackSetOK
PPTreeSubSet
,
trackNewOK
PPTreeSubSet
)
{
t
.
Helper
()
assertTrack
(
t
,
subj
+
": trackSet"
,
δbtail
.
trackSet
,
trackSetOK
)
assertTrack
(
t
,
subj
+
": trackNew"
,
δbtail
.
trackNew
,
trackNewOK
)
_assertTrack
(
t
,
subj
+
": trackSet"
,
δBtail
.
trackSet
,
trackSetOK
)
roots
:=
SetOid
{}
for
root
:=
range
δBtail
.
vδTbyRoot
{
roots
.
Add
(
root
)
}
nrootsOK
:=
1
if
trackSetOK
.
Empty
()
&&
trackNewOK
.
Empty
()
{
nrootsOK
=
0
}
if
len
(
roots
)
!=
nrootsOK
{
t
.
Errorf
(
"%s: len(vδTbyRoot) != %d ; roots=%v"
,
subj
,
nrootsOK
,
roots
)
return
}
if
nrootsOK
==
0
{
return
}
root
:=
roots
.
Elements
()[
0
]
δTtail
:=
δBtail
.
vδTbyRoot
[
root
]
trackNewRootsOK
:=
SetOid
{}
if
!
trackNewOK
.
Empty
()
{
trackNewRootsOK
.
Add
(
root
)
}
if
!
δBtail
.
trackNewRoots
.
Equal
(
trackNewRootsOK
)
{
t
.
Errorf
(
"%s: trackNewRoots:
\n\t
have: %v
\n\t
want: %v"
,
subj
,
δBtail
.
trackNewRoots
,
trackNewRootsOK
)
}
_assertTrack
(
t
,
subj
+
": vδT.trackNew"
,
δTtail
.
trackNew
,
trackNewOK
)
}
// xverifyΔBTail_rebuild verifies δBtail.rebuild during t0->t1->t2 transition.
...
...
@@ -1079,7 +1115,7 @@ func xverifyΔBTail_rebuild_TR(t *testing.T, db *zodb.DB, δbtail *ΔBtail, tj *
δbtail
.
assertTrack
(
t
,
fmt
.
Sprintf
(
"@%s: after Track%v"
,
xat
[
tj
.
at
],
keys
),
trackSet
,
trackNew
)
// XXX vδB=[ø]
δbtail
.
rebuild
()
δbtail
.
rebuild
All
()
δbtail
.
assertTrack
(
t
,
fmt
.
Sprintf
(
"@%s: after Track%v + rebuild"
,
xat
[
tj
.
at
],
keys
),
trackSetAfterRebuild
,
ø
)
// XXX assert vδB=[δ1/T(keys)]
...
...
wcfs/internal/zdata/δftail.go
View file @
f01f7677
...
...
@@ -233,7 +233,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *xzodb.ZConn) (_ ΔF
δF
:=
ΔF
{
Rev
:
δB
.
Rev
,
ByFile
:
make
(
map
[
*
ZBigFile
]
*
ΔFile
)}
// take btree changes into account
for
root
,
δt
:=
range
δB
.
ByRoot
{
for
root
,
δt
:=
range
δB
.
Δ
ByRoot
{
files
:=
δFtail
.
fileIdx
[
root
]
if
len
(
files
)
==
0
{
panicf
(
"BUG: ΔFtail: root<%s> -> ø files"
,
root
)
...
...
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