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
8402f4c3
Commit
8402f4c3
authored
Jun 24, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c34907cf
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
29 deletions
+16
-29
wcfs/internal/xbtree/pptreesubset.go
wcfs/internal/xbtree/pptreesubset.go
+2
-4
wcfs/internal/xbtree/pptreesubset_test.go
wcfs/internal/xbtree/pptreesubset_test.go
+1
-0
wcfs/internal/xbtree/treediff.go
wcfs/internal/xbtree/treediff.go
+2
-2
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+11
-19
wcfs/internal/xbtree/δbtail_test.go
wcfs/internal/xbtree/δbtail_test.go
+0
-4
No files found.
wcfs/internal/xbtree/pptreesubset.go
View file @
8402f4c3
...
...
@@ -59,7 +59,6 @@ type PPTreeSubSet map[zodb.Oid]*nodeInTree
type
nodeInTree
struct
{
parent
zodb
.
Oid
// parent node | InvalidOid for root
nchild
int
// number of direct children in PPTreeSubSet referring to this node
// XXX + [lo,hi) range this node is coming under in its parent XXX -> in its tree ?
}
// Has returns whether node is in the set.
...
...
@@ -155,7 +154,7 @@ func normPath(path []zodb.Oid) []zodb.Oid {
return
path
}
// ---- Union/Difference/Interse
tctior
----
// ---- Union/Difference/Interse
ction
----
// Union returns U = PP(A.leafs | B.leafs)
//
...
...
@@ -212,7 +211,7 @@ func (A PPTreeSubSet) DifferenceInplace(B PPTreeSubSet) {
A
.
xDifferenceInplace
(
B
)
}
//
XXX
Intersection
//
TODO
Intersection
func
(
A
PPTreeSubSet
)
xUnionInplace
(
B
PPTreeSubSet
)
{
if
tracePPSet
{
...
...
@@ -333,7 +332,6 @@ func (S PPTreeSubSet) gc1(oid zodb.Oid) {
for
oid
!=
zodb
.
InvalidOid
{
t
:=
S
[
oid
]
t
.
nchild
--
// if t.nchild > 0 || /* root node */t.parent == zodb.InvalidOid {
if
t
.
nchild
>
0
{
break
}
...
...
wcfs/internal/xbtree/pptreesubset_test.go
View file @
8402f4c3
...
...
@@ -88,6 +88,7 @@ func TestPPTreeSubSetOps(t *testing.T) {
S
{}),
// D
}
// assert1 asserts that result of op(A,B) == resOK.
assert1
:=
func
(
op
string
,
A
,
B
,
res
,
resOK
S
)
{
t
.
Helper
()
if
res
.
Equal
(
resOK
)
{
...
...
wcfs/internal/xbtree/treediff.go
View file @
8402f4c3
...
...
@@ -576,7 +576,7 @@ ABcov:
}
// {} oid -> nodeInRange for all nodes we've came through in Bv:
//
current and previously expanded - up till top B
//
current and previously expanded - up till top B.
BnodeIdx
:=
map
[
zodb
.
Oid
]
*
nodeInRange
{}
if
!
Bempty
{
BnodeIdx
[
ABoid
]
=
btop
...
...
@@ -590,7 +590,7 @@ ABcov:
// by default a node contributes to δ-
// a node ac does not contribute to δ- and can be skipped, if:
// - ac is not tracked, or
// - ac ∉ δZTC && ∃ bc from B: ac.oid == bc.oid && ac.key
range == bc.keyrange
// - ac ∉ δZTC && ∃ bc from B: ac.oid == bc.oid && ac.key
cov == bc.keycov
// (ac+ac.children were not changed, ac stays in the tree with the same key range coverage)
Aq
:=
[]
*
nodeInRange
{
atop
}
// queue for A nodes that contribute to δ-
for
len
(
Aq
)
>
0
{
...
...
wcfs/internal/xbtree/δbtail.go
View file @
8402f4c3
...
...
@@ -33,10 +33,6 @@ import (
"lab.nexedi.com/nexedi/wendelin.core/wcfs/internal/xtail"
)
// XXX malfancitioning rebuild currently breaks wcfs tests
// TODO kill this after rebuild is finished
const
XXX_killWhenRebuildWorks
=
true
const
traceΔBtail
=
false
const
debugΔBtail
=
false
...
...
@@ -271,7 +267,7 @@ func (δBtail *ΔBtail) track(key Key, path []zodb.Oid) error {
// XXX locking
// first normalize path: remove embedded bucket and check if it was an
// empty artificial tree. We need to do the normalization becase we
// empty artificial tree. We need to do the normalization beca
u
se we
// later check whether leaf path[-1] ∈ trackSet and without
// normalization path[-1] can be InvalidOid.
path
=
normPath
(
path
)
...
...
@@ -375,10 +371,17 @@ func (δTtail *ΔTtail) rebuild(root zodb.Oid, δZtail *zodb.ΔTail, db *zodb.DB
}
// an iteration closer to tail may turn out to add a key to the tracking set.
// We have to recheck all entries newer that revision for changes to that key
// We have to recheck all entries newer that revision for changes to that key
,
// for example:
//
// XXX
// 8 5*
// / \ <- / \
// 2 8 2* 7
//
// here initial tracked set is 5*-2*. Going to earlier revision
// 2'th keycov range is widen from [-∞,5) to [-∞,7), so 5*-7 in
// later revision have to be rechecked because 7 was added into
// tracking set.
//
// Implement this via restarting from head and cycling until
// set of tracked keys does not grow anymore.
...
...
@@ -602,22 +605,11 @@ func (δBtail *ΔBtail) _Update1(δZ *zodb.EventCommit) (δB1 _ΔBUpdate1, err e
δB1
=
_ΔBUpdate1
{
ByRoot
:
make
(
map
[
zodb
.
Oid
]
*
_ΔTUpdate1
)}
if
XXX_killWhenRebuildWorks
{
// XXX hack - until vvv is reenabled
for
root
:=
range
δBtail
.
trackNewRoots
{
δTtail
:=
δBtail
.
vδTbyRoot
[
root
]
// must succeed
δBtail
.
trackSet
.
UnionInplace
(
δTtail
.
trackNew
)
δTtail
.
trackNew
=
PPTreeSubSet
{}
}
δBtail
.
trackNewRoots
=
SetOid
{}
}
else
{
// XXX reenable (currently breaks wcfs tests)
// update .trackSet and vδB from .trackNew
err
=
δBtail
.
rebuildAll
()
if
err
!=
nil
{
return
δB1
,
err
}
}
// XXX dup wrt rebuild?
...
...
@@ -666,7 +658,7 @@ if XXX_killWhenRebuildWorks {
func
(
δBtail
*
ΔBtail
)
ForgetPast
(
revCut
zodb
.
Tid
)
{
δBtail
.
δZtail
.
ForgetPast
(
revCut
)
// XXX stub
// TODO go thro
o
ugh vδBroots till revcut -> find which trees to trim -> trim ΔTtails.
// TODO go through vδBroots till revcut -> find which trees to trim -> trim ΔTtails.
panic
(
"TODO"
)
}
...
...
wcfs/internal/xbtree/δbtail_test.go
View file @
8402f4c3
...
...
@@ -1154,9 +1154,6 @@ func assertΔTtail(t *testing.T, subj string, δbtail *ΔBtail, db *zodb.DB, tj
t0
=
t0
.
prev
}
vδTok
=
vδTok_
// lo := t0.at
// hi := tj.at
// vδToid := δbtail.SliceByRootRev(treeRoot, lo, hi)
δTtail
,
ok
:=
δbtail
.
vδTbyRoot
[
treeRoot
]
var
vδToid
[]
ΔTree
if
ok
{
...
...
@@ -1166,7 +1163,6 @@ func assertΔTtail(t *testing.T, subj string, δbtail *ΔBtail, db *zodb.DB, tj
l
=
len
(
vδToid
)
var
vat
[]
zodb
.
Tid
var
vδT
[]
map
[
Key
]
Δstring
// atPrev := lo
atPrev
:=
t0
.
at
for
_
,
δToid
:=
range
vδToid
{
vat
=
append
(
vat
,
δToid
.
Rev
)
...
...
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