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
51fb2628
Commit
51fb2628
authored
Jun 23, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a6760d8f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
7 deletions
+34
-7
wcfs/δbtail.go
wcfs/δbtail.go
+34
-7
No files found.
wcfs/δbtail.go
View file @
51fb2628
...
@@ -184,8 +184,9 @@ type ΔBtail struct {
...
@@ -184,8 +184,9 @@ type ΔBtail struct {
// XXX place
// XXX place
// nodeTrack represents tracking information about a node.
// nodeTrack represents tracking information about a node.
type
nodeTrack
struct
{
type
nodeTrack
struct
{
parent
zodb
.
Oid
// parent node | InvalidOid for root
parent
zodb
.
Oid
// parent node | InvalidOid for root
trackedKeys
SetKey
// keys tracked under this node; nil for root XXX only !empty root
holes
SetKey
// missing keys tracked under this node XXX nil for root(?) XXX only !empty root
trackedKeys
SetKey
// XXX kill
}
}
// ΔB represents a change in BTrees space.
// ΔB represents a change in BTrees space.
...
@@ -306,7 +307,7 @@ func (δBtail *ΔBtail) Track(ctx context.Context, key Key, keyPresent bool, pat
...
@@ -306,7 +307,7 @@ func (δBtail *ΔBtail) Track(ctx context.Context, key Key, keyPresent bool, pat
// XXX check for InvalidOid (e.g. T/B1:a with bucket not having its own oid.
// XXX check for InvalidOid (e.g. T/B1:a with bucket not having its own oid.
track
,
oldTrack
=
δBtail
.
trackIdx
[
oid
]
track
,
oldTrack
=
δBtail
.
trackIdx
[
oid
]
if
!
oldTrack
{
if
!
oldTrack
{
track
=
nodeTrack
{
parent
:
parent
,
trackedKeys
:
SetKey
{}}
track
=
nodeTrack
{
parent
:
parent
,
holes
:
SetKey
{},
trackedKeys
:
SetKey
{}}
δBtail
.
trackIdx
[
oid
]
=
track
δBtail
.
trackIdx
[
oid
]
=
track
// XXX .trackNew += oid
// XXX .trackNew += oid
}
}
...
@@ -321,6 +322,17 @@ func (δBtail *ΔBtail) Track(ctx context.Context, key Key, keyPresent bool, pat
...
@@ -321,6 +322,17 @@ func (δBtail *ΔBtail) Track(ctx context.Context, key Key, keyPresent bool, pat
parent
=
oid
parent
=
oid
}
}
// remember tracked holes in trackIdx
if
!
keyPresent
{
if
leafBucket
!=
nil
{
track
.
holes
.
Add
(
key
)
}
else
{
// empty tree
rootTrack
:=
δBtail
.
trackIdx
[
root
]
// must succeed
rootTrack
.
holes
.
Add
(
key
)
}
}
// tracked += all keys of leaf bucket for every node up to the root
// tracked += all keys of leaf bucket for every node up to the root
fmt
.
Printf
(
" oldTrack: %v leafBucket: %v
\n
"
,
oldTrack
,
leafBucket
)
fmt
.
Printf
(
" oldTrack: %v leafBucket: %v
\n
"
,
oldTrack
,
leafBucket
)
if
!
oldTrack
&&
leafBucket
!=
nil
{
if
!
oldTrack
&&
leafBucket
!=
nil
{
...
@@ -360,6 +372,7 @@ func (δBtail *ΔBtail) Track(ctx context.Context, key Key, keyPresent bool, pat
...
@@ -360,6 +372,7 @@ func (δBtail *ΔBtail) Track(ctx context.Context, key Key, keyPresent bool, pat
}
}
}
}
_
,
ok
:=
δBtail
.
byRoot
[
root
]
_
,
ok
:=
δBtail
.
byRoot
[
root
]
if
!
ok
{
if
!
ok
{
δBtail
.
byRoot
[
root
]
=
newΔTtail
()
δBtail
.
byRoot
[
root
]
=
newΔTtail
()
...
@@ -558,6 +571,7 @@ func (prs *rangeSplit) Expand(rnode *nodeInRange) (children rangeSplit) {
...
@@ -558,6 +571,7 @@ func (prs *rangeSplit) Expand(rnode *nodeInRange) (children rangeSplit) {
// [len(ev)].Key = +∞ ; should be assumed so
// [len(ev)].Key = +∞ ; should be assumed so
tree
:=
rnode
.
node
.
(
*
Tree
)
tree
:=
rnode
.
node
.
(
*
Tree
)
treev
:=
tree
.
Entryv
()
treev
:=
tree
.
Entryv
()
fmt
.
Printf
(
"E treev: %v
\n
"
,
treev
)
children
=
make
(
rangeSplit
,
0
,
len
(
treev
)
+
1
)
children
=
make
(
rangeSplit
,
0
,
len
(
treev
)
+
1
)
for
i
:=
range
treev
{
for
i
:=
range
treev
{
lo
:=
rnode
.
lo
lo
:=
rnode
.
lo
...
@@ -572,6 +586,8 @@ func (prs *rangeSplit) Expand(rnode *nodeInRange) (children rangeSplit) {
...
@@ -572,6 +586,8 @@ func (prs *rangeSplit) Expand(rnode *nodeInRange) (children rangeSplit) {
children
=
append
(
children
,
&
nodeInRange
{
lo
,
hi_
,
treev
[
i
]
.
Child
()})
children
=
append
(
children
,
&
nodeInRange
{
lo
,
hi_
,
treev
[
i
]
.
Child
()})
}
}
fmt
.
Printf
(
"E children: %s
\n
"
,
children
)
// del[i]; insert(@i, children)
// del[i]; insert(@i, children)
*
prs
=
append
(
rs
[
:
i
],
append
(
children
,
rs
[
i
+
1
:
]
...
)
...
)
*
prs
=
append
(
rs
[
:
i
],
append
(
children
,
rs
[
i
+
1
:
]
...
)
...
)
return
children
return
children
...
@@ -739,9 +755,11 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
...
@@ -739,9 +755,11 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
// initial phase: expand changed nodes in a till buckets;
// initial phase: expand changed nodes in a till buckets;
// XXX changed buckets -> δ-
// XXX changed buckets -> δ-
if
a
!=
nil
{
// XXX kill (always !nil) ?
if
a
!=
nil
{
// XXX kill (always !nil) ?
fmt
.
Println
(
"ZZZ"
)
// XXX maybe walk till a from root to get more precise initial range?
// XXX maybe walk till a from root to get more precise initial range?
atop
:=
&
nodeInRange
{
lo
:
KeyMin
,
hi_
:
KeyMax
,
node
:
a
}
// [-∞, ∞)
atop
:=
&
nodeInRange
{
lo
:
KeyMin
,
hi_
:
KeyMax
,
node
:
a
}
// [-∞, ∞)
av
=
rangeSplit
{
atop
}
av
=
rangeSplit
{
atop
}
fmt
.
Printf
(
"X av: %s
\n
"
,
av
)
aq
:=
[]
*
nodeInRange
{
atop
}
// stack
aq
:=
[]
*
nodeInRange
{
atop
}
// stack
for
len
(
aq
)
>
0
{
for
len
(
aq
)
>
0
{
l
:=
len
(
aq
)
l
:=
len
(
aq
)
...
@@ -750,6 +768,8 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
...
@@ -750,6 +768,8 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
defer
arn
.
node
.
PDeactivate
()
defer
arn
.
node
.
PDeactivate
()
children
:=
av
.
Expand
(
arn
)
children
:=
av
.
Expand
(
arn
)
fmt
.
Printf
(
"Y children: %s
\n
"
,
children
)
fmt
.
Printf
(
"Y av: %s
\n
"
,
av
)
for
_
,
rchild
:=
range
children
{
for
_
,
rchild
:=
range
children
{
coid
:=
rchild
.
node
.
POid
()
coid
:=
rchild
.
node
.
POid
()
if
!
(
δZTC
.
Has
(
coid
)
||
if
!
(
δZTC
.
Has
(
coid
)
||
...
@@ -758,16 +778,23 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
...
@@ -758,16 +778,23 @@ func diffT(ctx context.Context, a, b *Tree, δZTC SetOid, trackIdx map[zodb.Oid]
continue
continue
}
}
switch
rchild
.
node
.
(
type
)
{
switch
node
:=
rchild
.
node
.
(
type
)
{
case
*
Tree
:
case
*
Tree
:
aq
=
append
(
aq
,
rchild
)
aq
=
append
(
aq
,
rchild
)
case
*
Bucket
:
case
*
Bucket
:
// XXX also -[k]ø (for tracked DEL)
δA
,
err
:=
diffB
(
ctx
,
node
,
nil
)
δA
,
err
:=
diffB
(
ctx
,
rchild
.
node
.
(
*
Bucket
),
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
// also -[k]ø (for tracked holes)
track
,
ok
:=
trackIdx
[
node
.
POid
()]
if
!
ok
{
panicf
(
"%s ∈ δZTC, but ∉ trackIdx"
,
vnode
(
node
))
}
for
k
:=
range
track
.
holes
{
δA
[
k
]
=
ΔValue
{
VDEL
,
VDEL
}
// ø->ø indicates hole
}
// δ <- δA
// δ <- δA
err
=
δMerge
(
δ
,
δA
)
err
=
δMerge
(
δ
,
δA
)
...
@@ -1386,5 +1413,5 @@ func (rn nodeInRange) String() string {
...
@@ -1386,5 +1413,5 @@ func (rn nodeInRange) String() string {
}
}
func
(
track
nodeTrack
)
String
()
string
{
func
(
track
nodeTrack
)
String
()
string
{
return
fmt
.
Sprintf
(
"{p%s
k%s}"
,
track
.
parent
,
track
.
trackedKeys
)
return
fmt
.
Sprintf
(
"{p%s
h%s k%s}"
,
track
.
parent
,
track
.
holes
,
track
.
trackedKeys
)
}
}
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