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
0700f488
Commit
0700f488
authored
Jun 23, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
82fd3e37
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
33 deletions
+53
-33
wcfs/δbtail.go
wcfs/δbtail.go
+53
-33
No files found.
wcfs/δbtail.go
View file @
0700f488
...
...
@@ -762,7 +762,14 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
aq
=
append
(
aq
,
rchild
)
case
*
Bucket
:
// XXX δ += -[k]v -[k]ø (for tracked DEL)
// XXX also -[k]ø (for tracked DEL)
δA
,
err
:=
diffB
(
ctx
,
rchild
.
node
.
(
*
Bucket
),
nil
)
if
err
!=
nil
{
return
nil
,
err
}
// XXX δ <- δA
// XXX AKeysDone <- δA
}
}
}
...
...
@@ -777,11 +784,14 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
bv
=
rangeSplit
{
btop
}
}
for
k
:=
range
Bkeysq
{
BKeysDone
.
Add
(
k
)
bbucket
,
ok
,
err
:=
bv
.
GetToBucket
(
ctx
,
k
)
if
!
ok
{
continue
// key not covered
}
// XXX check bucket for already "done" (i.e. taken into account)
bbucket
.
node
.
(
*
Bucket
)
δB
,
err
:=
diffB
(
ctx
,
nil
,
bbucket
.
node
.
(
*
Bucket
))
if
err
!=
nil
{
...
...
@@ -790,7 +800,9 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
// XXX δ <- δB
for
k
,
δv
:=
range
δ
{
//
if
!
AKeysDone
.
Has
(
k
)
{
Akeysq
.
Add
(
k
)
}
}
}
...
...
@@ -869,37 +881,7 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
}
// merge δ <- δc
for
k
,
δv1
:=
range
δc
{
δv2
,
already
:=
δ
[
k
]
if
!
already
{
δ
[
k
]
=
δv1
continue
}
// both δ and δc has [k] - it can be that key
// entry migrated from one bucket into another.
if
!
(
(
δv2
.
New
==
VDEL
&&
δv1
.
Old
==
VDEL
)
||
(
δv2
.
Old
==
VDEL
&&
δv1
.
New
==
VDEL
)
)
{
return
nil
,
fmt
.
Errorf
(
"BUG or btree corrupt: [%v] has "
+
"duplicate entries: %v, %v"
,
k
,
δv1
,
δv2
)
}
δv
:=
ΔValue
{}
if
δv1
.
New
==
VDEL
{
δv
.
Old
=
δv1
.
Old
δv
.
New
=
δv2
.
New
}
else
{
δv
.
Old
=
δv2
.
Old
δv
.
New
=
δv1
.
New
}
fmt
.
Printf
(
" [%v] merge %s %s -> %s
\n
"
,
k
,
δv1
,
δv2
,
δv
)
if
δv
.
Old
!=
δv
.
New
{
δ
[
k
]
=
δv
}
else
{
delete
(
δ
,
k
)
}
}
δmergeInto
(
δ
,
δc
)
// update δc -> tracked keys
...
...
@@ -933,6 +915,44 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
}
// δmergeInto merges changes from δ2 into δ.
// Usually δ is total-building δ, while δ2 is diff from comparing some subnodes.
func
δmergeInto
(
δ
,
δ2
map
[
Key
]
ΔValue
)
{
// merge δ <- δ2
for
k
,
δv2
:=
range
δ2
{
δv1
,
already
:=
δ
[
k
]
if
!
already
{
δ
[
k
]
=
δv2
continue
}
// both δ and δ2 has [k] - it can be that key
// entry migrated from one bucket into another.
if
!
(
(
δv1
.
New
==
VDEL
&&
δv2
.
Old
==
VDEL
)
||
(
δv1
.
Old
==
VDEL
&&
δv2
.
New
==
VDEL
)
)
{
return
nil
,
fmt
.
Errorf
(
"BUG or btree corrupt: [%v] has "
+
"duplicate entries: %v, %v"
,
k
,
δv1
,
δv2
)
}
δv
:=
ΔValue
{}
if
δv2
.
New
==
VDEL
{
δv
.
Old
=
δv2
.
Old
δv
.
New
=
δv1
.
New
}
else
{
δv
.
Old
=
δv1
.
Old
δv
.
New
=
δv2
.
New
}
fmt
.
Printf
(
" [%v] merge %s %s -> %s
\n
"
,
k
,
δv1
,
δv2
,
δv
)
if
δv
.
Old
!=
δv
.
New
{
δ
[
k
]
=
δv
}
else
{
delete
(
δ
,
k
)
}
}
}
func
__diffT
(
ctx
context
.
Context
,
a
,
b
*
Tree
,
δZTC
SetOid
,
trackIdx
map
[
zodb
.
Oid
]
nodeTrack
)
(
δ
map
[
Key
]
ΔValue
,
err
error
)
{
fmt
.
Printf
(
" T %s %s
\n
"
,
xidOf
(
a
),
xidOf
(
b
))
...
...
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