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
fc61ff19
Commit
fc61ff19
authored
Jun 11, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ef5e5183
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
9 deletions
+20
-9
wcfs/internal/xbtree/treediff.go
wcfs/internal/xbtree/treediff.go
+15
-4
wcfs/internal/xbtree/δbtail_test.go
wcfs/internal/xbtree/δbtail_test.go
+5
-5
No files found.
wcfs/internal/xbtree/treediff.go
View file @
fc61ff19
...
@@ -82,7 +82,7 @@ import (
...
@@ -82,7 +82,7 @@ import (
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xzodb"
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xzodb"
)
)
const
traceDiff
=
fals
e
const
traceDiff
=
tru
e
const
debugDiff
=
false
const
debugDiff
=
false
// ΔValue represents change in value.
// ΔValue represents change in value.
...
@@ -481,6 +481,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
...
@@ -481,6 +481,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
// this way, if later, the subtree will be recreated, that change won't be missed
// this way, if later, the subtree will be recreated, that change won't be missed
δtrack
.
Del
.
AddPath
(
ABpath
)
δtrack
.
Del
.
AddPath
(
ABpath
)
δtrack
.
Add
.
AddPath
(
ABpath
)
δtrack
.
Add
.
AddPath
(
ABpath
)
// δtkeycov stays ø
}
}
// A|B == nil -> artificial empty tree
// A|B == nil -> artificial empty tree
...
@@ -532,6 +533,10 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
...
@@ -532,6 +533,10 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
BtrackSet
.
AddPath
(
ABpath
)
BtrackSet
.
AddPath
(
ABpath
)
}
}
// δtkeycov will be = BAdd \ ADel
δtkeycovADel
:=
&
RangedKeySet
{}
δtkeycovBAdd
:=
&
RangedKeySet
{}
// phase 1: expand A top->down driven by δZTC.
// phase 1: expand A top->down driven by δZTC.
// by default a node contributes to δ-
// by default a node contributes to δ-
// a node ac does not contribute to δ- and can be skipped, if:
// a node ac does not contribute to δ- and can be skipped, if:
...
@@ -554,9 +559,11 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
...
@@ -554,9 +559,11 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
δA
,
err
:=
diffB
(
ctx
,
a
,
nil
);
/*X*/
if
err
!=
nil
{
return
nil
,
nil
,
nil
,
err
}
δA
,
err
:=
diffB
(
ctx
,
a
,
nil
);
/*X*/
if
err
!=
nil
{
return
nil
,
nil
,
nil
,
err
}
err
=
δMerge
(
δ
,
δA
);
/*X*/
if
err
!=
nil
{
return
nil
,
nil
,
nil
,
err
}
err
=
δMerge
(
δ
,
δA
);
/*X*/
if
err
!=
nil
{
return
nil
,
nil
,
nil
,
err
}
δtrack
.
Del
.
AddPath
(
ra
.
Path
())
δtrack
.
Del
.
AddPath
(
ra
.
Path
())
ar
:=
KeyRange
{
ra
.
lo
,
ra
.
hi_
}
δtkeycovADel
.
AddRange
(
ar
)
// Bkqueue <- ra.range
// Bkqueue <- ra.range
Bktodo
(
KeyRange
{
ra
.
lo
,
ra
.
hi_
}
)
Bktodo
(
ar
)
ra
.
done
=
true
ra
.
done
=
true
case
*
Tree
:
case
*
Tree
:
...
@@ -625,6 +632,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
...
@@ -625,6 +632,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
if
nc
:=
at
.
nchild
;
nc
!=
0
{
if
nc
:=
at
.
nchild
;
nc
!=
0
{
δtrack
.
δnchildNonLeafs
[
acOid
]
=
nc
δtrack
.
δnchildNonLeafs
[
acOid
]
=
nc
}
}
// XXX δtkeycov
}
}
continue
continue
...
@@ -680,9 +688,10 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
...
@@ -680,9 +688,10 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
// δ <- δB
// δ <- δB
err
=
δMerge
(
δ
,
δB
);
/*X*/
if
err
!=
nil
{
return
nil
,
nil
,
nil
,
err
}
err
=
δMerge
(
δ
,
δB
);
/*X*/
if
err
!=
nil
{
return
nil
,
nil
,
nil
,
err
}
δtrack
.
Add
.
AddPath
(
b
.
Path
())
δtrack
.
Add
.
AddPath
(
b
.
Path
())
br
:=
KeyRange
{
b
.
lo
,
b
.
hi_
}
δtkeycovBAdd
.
AddRange
(
br
)
// Akqueue <- δB
// Akqueue <- δB
br
:=
KeyRange
{
b
.
lo
,
b
.
hi_
}
Bkdone
.
AddRange
(
br
)
Bkdone
.
AddRange
(
br
)
Aktodo
(
br
)
Aktodo
(
br
)
...
@@ -717,9 +726,10 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
...
@@ -717,9 +726,10 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
// δ <- δA
// δ <- δA
err
=
δMerge
(
δ
,
δA
);
/*X*/
if
err
!=
nil
{
return
nil
,
nil
,
nil
,
err
}
err
=
δMerge
(
δ
,
δA
);
/*X*/
if
err
!=
nil
{
return
nil
,
nil
,
nil
,
err
}
δtrack
.
Del
.
AddPath
(
a
.
Path
())
δtrack
.
Del
.
AddPath
(
a
.
Path
())
ar
:=
KeyRange
{
a
.
lo
,
a
.
hi_
}
δtkeycovADel
.
AddRange
(
ar
)
// Bkqueue <- a.range
// Bkqueue <- a.range
ar
:=
KeyRange
{
a
.
lo
,
a
.
hi_
}
Akdone
.
AddRange
(
ar
)
Akdone
.
AddRange
(
ar
)
Bktodo
(
ar
)
Bktodo
(
ar
)
...
@@ -736,6 +746,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
...
@@ -736,6 +746,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
Akqueue
.
Clear
()
Akqueue
.
Clear
()
}
}
δtkeycov
=
δtkeycovBAdd
.
Difference
(
δtkeycovADel
)
return
δ
,
δtrack
,
δtkeycov
,
nil
return
δ
,
δtrack
,
δtkeycov
,
nil
}
}
...
...
wcfs/internal/xbtree/δbtail_test.go
View file @
fc61ff19
...
@@ -835,11 +835,11 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
...
@@ -835,11 +835,11 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
return
return
}
}
// assert δtkey
C
ov == δ(tkeyCov1, tkeyCov2)
// assert δtkey
c
ov == δ(tkeyCov1, tkeyCov2)
δtkey
C
ovOK
:=
tkeyCov2
.
Difference
(
tkeyCov1
)
δtkey
c
ovOK
:=
tkeyCov2
.
Difference
(
tkeyCov1
)
δtkey
C
ov
:=
δTKeyCov
.
ByRoot
[
treeRoot
]
δtkey
c
ov
:=
δTKeyCov
.
ByRoot
[
treeRoot
]
if
!
δtkey
Cov
.
Equal
(
δtkeyC
ovOK
)
{
if
!
δtkey
cov
.
Equal
(
δtkeyc
ovOK
)
{
badf
(
"δtkey
Cov wrong:
\n
have: %s
\n
want: %s"
,
δtkeyCov
,
δtkeyC
ovOK
)
badf
(
"δtkey
cov wrong:
\n
have: %s
\n
want: %s"
,
δtkeycov
,
δtkeyc
ovOK
)
}
}
...
...
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