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
6e63c63d
Commit
6e63c63d
authored
Sep 07, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
34aecd3a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
37 deletions
+32
-37
wcfs/δbtail.go
wcfs/δbtail.go
+32
-37
No files found.
wcfs/δbtail.go
View file @
6e63c63d
...
@@ -366,7 +366,7 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node) error { //
...
@@ -366,7 +366,7 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node) error { //
for
_
,
node
:=
range
path
{
pathv
=
append
(
pathv
,
vnode
(
node
))
}
for
_
,
node
:=
range
path
{
pathv
=
append
(
pathv
,
vnode
(
node
))
}
tracef
(
"Track [%v] %s
\n
"
,
key
,
strings
.
Join
(
pathv
,
" -> "
))
tracef
(
"Track [%v] %s
\n
"
,
key
,
strings
.
Join
(
pathv
,
" -> "
))
δBtail
.
trackIdx
.
AddPath
(
path
)
δBtail
.
trackIdx
.
Add
Node
Path
(
path
)
// parent := zodb.InvalidOid
// parent := zodb.InvalidOid
// var ptrack *nodeTrack = nil
// var ptrack *nodeTrack = nil
...
@@ -432,21 +432,28 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node) error { //
...
@@ -432,21 +432,28 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node) error { //
// XXX place
// XXX place
// XXX doc
// XXX doc
func
(
tidx
trackIndex
)
AddPath
(
path
[]
Node
)
{
// XXX Tree|Bucket; path[0] = root
func
(
tidx
trackIndex
)
AddNodePath
(
path
[]
Node
)
{
// XXX Tree|Bucket; path[0] = root
// XXX assert Tree Tree ... Tree Bucket
// root := path[0].(*Tree).POid()
oidv
:=
[]
zodb
.
Oid
{}
for
_
,
node
:=
range
path
{
oidv
=
append
(
oidv
,
node
.
POid
())
}
tidx
.
AddPath
(
oidv
)
}
func
(
tidx
trackIndex
)
AddPath
(
path
[]
zodb
.
Oid
)
{
l
:=
len
(
path
)
l
:=
len
(
path
)
if
l
==
0
{
if
l
==
0
{
panic
(
"empty path"
)
panic
(
"empty path"
)
}
}
// XXX assert Tree Tree ... Tree Bucket
// root := path[0].(*Tree).POid()
parent
:=
zodb
.
InvalidOid
parent
:=
zodb
.
InvalidOid
var
ptrack
*
nodeTrack
=
nil
var
ptrack
*
nodeTrack
=
nil
var
track
*
nodeTrack
// XXX kill here
var
track
*
nodeTrack
// XXX kill here
var
oldTrack
bool
var
oldTrack
bool
for
_
,
node
:=
range
path
{
// XXX -> trackIndex.AddPath(path) ?
for
_
,
oid
:=
range
path
{
oid
:=
node
.
POid
()
// XXX skip InvalidOid ?
// XXX skip InvalidOid ?
// InvalidOid means embedded bucket - e.g. T/B1:a with bucket not having its own oid.
// InvalidOid means embedded bucket - e.g. T/B1:a with bucket not having its own oid.
...
@@ -600,13 +607,14 @@ func (δBtail *ΔBtail) δZConnectTracked(δZv *zodb.EventCommit) (δZTC SetOid,
...
@@ -600,13 +607,14 @@ func (δBtail *ΔBtail) δZConnectTracked(δZv *zodb.EventCommit) (δZTC SetOid,
// XXX place
// XXX place
// nodeInRange represents a Node coming under [lo, hi_] key range in its tree.
// nodeInRange represents a Node coming under [lo, hi_] key range in its tree.
type
nodeInRange
struct
{
type
nodeInRange
struct
{
p
arent
*
nodeInRange
p
refix
[]
zodb
.
Oid
// path to this node goes via this objects
lo
,
hi_
Key
// [lo, hi_] NOTE _not_ hi) not to overflow at ∞
lo
,
hi_
Key
// [lo, hi_] NOTE _not_ hi) not to overflow at ∞
node
Node
node
Node
done
bool
// whether this node was already taken into account while computing diff
done
bool
// whether this node was already taken into account while computing diff
}
}
// XXX place, doc
// XXX place, doc
/*
func (n *nodeInRange) NodePath() []Node {
func (n *nodeInRange) NodePath() []Node {
path := []Node{}
path := []Node{}
for n != nil {
for n != nil {
...
@@ -615,6 +623,10 @@ func (n *nodeInRange) NodePath() []Node {
...
@@ -615,6 +623,10 @@ func (n *nodeInRange) NodePath() []Node {
}
}
return path
return path
}
}
*/
func
(
n
*
nodeInRange
)
Path
()
[]
zodb
.
Oid
{
return
append
(
n
.
prefix
,
n
.
node
.
POid
())
}
// rangeSplit represents set of nodes covering a range.
// rangeSplit represents set of nodes covering a range.
// nodes come with key↑ and no intersection in between their [lo,hi)
// nodes come with key↑ and no intersection in between their [lo,hi)
...
@@ -681,7 +693,7 @@ func (prs *rangeSplit) Expand(rnode *nodeInRange) (children rangeSplit) {
...
@@ -681,7 +693,7 @@ func (prs *rangeSplit) Expand(rnode *nodeInRange) (children rangeSplit) {
}
}
children
=
append
(
children
,
&
nodeInRange
{
children
=
append
(
children
,
&
nodeInRange
{
p
arent
:
rnode
,
p
refix
:
rnode
.
Path
()
,
lo
:
lo
,
lo
:
lo
,
hi_
:
hi_
,
hi_
:
hi_
,
node
:
treev
[
i
]
.
Child
(),
node
:
treev
[
i
]
.
Child
(),
...
@@ -814,31 +826,6 @@ func treediff(ctx context.Context, root zodb.Oid, δtops SetOid, δZTC SetOid, t
...
@@ -814,31 +826,6 @@ func treediff(ctx context.Context, root zodb.Oid, δtops SetOid, δZTC SetOid, t
trackIdx
.
ApplyΔ
(
δtrack
)
trackIdx
.
ApplyΔ
(
δtrack
)
}
}
/*
for leaf := range trackAdd {
node := leaf
for node != nil {
parent := node.parent
oid := node.node.POid()
poid := zodb.InvalidOid
if parent != nil {
poid = parent.node.POid()
}
track, already := trackIdx[oid]
if !already {
track = nodeTrack{parent: poid}
trackIdx[oid] = track
}
if track.parent != poid {
// XXX -> error (e.g. data corruption in ZODB)
panicf("node %s has multiple parents: %s %s", oid, poid, track.parent)
}
// XXX incref trackIdx[track.parent]
node = parent
}
}
*/
return
δT
,
nil
return
δT
,
nil
}
}
...
@@ -917,10 +904,18 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
...
@@ -917,10 +904,18 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
δtrack
=
&
δtrackIndex
{
DelLeaf
:
SetOid
{},
Add
:
trackIndex
{}}
δtrack
=
&
δtrackIndex
{
DelLeaf
:
SetOid
{},
Add
:
trackIndex
{}}
defer
tracef
(
" -> δ: %v
\n
"
,
δ
)
defer
tracef
(
" -> δ: %v
\n
"
,
δ
)
// path prefix to A and B
prefix
:=
[]
zodb
.
Oid
{}
t
:=
trackIdx
[
A
.
POid
()]
for
t
.
parent
!=
zodb
.
InvalidOid
{
prefix
=
append
([]
zodb
.
Oid
{
t
.
parent
},
prefix
...
)
t
=
trackIdx
[
t
.
parent
]
}
// initial split ranges for A and B
// initial split ranges for A and B
// 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
}
// [-∞, ∞) XXX parent?
atop
:=
&
nodeInRange
{
prefix
:
prefix
,
lo
:
KeyMin
,
hi_
:
KeyMax
,
node
:
A
}
// [-∞, ∞)
btop
:=
&
nodeInRange
{
lo
:
KeyMin
,
hi_
:
KeyMax
,
node
:
B
}
// [-∞, ∞) XXX parent?
btop
:=
&
nodeInRange
{
prefix
:
prefix
,
lo
:
KeyMin
,
hi_
:
KeyMax
,
node
:
B
}
// [-∞, ∞)
Av
:=
rangeSplit
{
atop
}
// nodes expanded from A
Av
:=
rangeSplit
{
atop
}
// nodes expanded from A
Bv
:=
rangeSplit
{
btop
}
// nodes expanded from B
Bv
:=
rangeSplit
{
btop
}
// nodes expanded from B
...
@@ -1094,7 +1089,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
...
@@ -1094,7 +1089,7 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackIdx trackIndex, h
// δ <- δB
// δ <- δB
err
=
δMerge
(
δ
,
δB
);
/*X*/
if
err
!=
nil
{
return
nil
,
nil
,
err
}
err
=
δMerge
(
δ
,
δB
);
/*X*/
if
err
!=
nil
{
return
nil
,
nil
,
err
}
δtrack
.
Add
.
AddPath
(
b
.
Node
Path
())
δtrack
.
Add
.
AddPath
(
b
.
Path
())
// trackAdd.Add(b)
// trackAdd.Add(b)
// Akqueue <- δB
// Akqueue <- δ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