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
6ad0052c
Commit
6ad0052c
authored
Aug 17, 2021
by
Kirill Smelkov
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X ΔBtail.Track: No need to return error
parent
682e4e1a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
21 deletions
+15
-21
wcfs/internal/xbtree/δbtail.go
wcfs/internal/xbtree/δbtail.go
+5
-7
wcfs/internal/xbtree/δbtail_test.go
wcfs/internal/xbtree/δbtail_test.go
+9
-10
wcfs/internal/zdata/δftail.go
wcfs/internal/zdata/δftail.go
+1
-4
No files found.
wcfs/internal/xbtree/δbtail.go
View file @
6ad0052c
...
@@ -240,8 +240,7 @@ func (δBtail *ΔBtail) Tail() zodb.Tid { return δBtail.δZtail.Tail() }
...
@@ -240,8 +240,7 @@ func (δBtail *ΔBtail) Tail() zodb.Tid { return δBtail.δZtail.Tail() }
//
//
// XXX catch cycles on add?
// XXX catch cycles on add?
// XXX no need to pass in key? (-> all keys, covered by leaf keyrange, will be added to tracking set of keys)
// XXX no need to pass in key? (-> all keys, covered by leaf keyrange, will be added to tracking set of keys)
// XXX no need to return error?
func
(
δBtail
*
ΔBtail
)
Track
(
key
Key
,
nodePath
[]
Node
)
{
// XXX Tree|Bucket; path[0] = root
func
(
δBtail
*
ΔBtail
)
Track
(
key
Key
,
nodePath
[]
Node
)
error
{
// XXX Tree|Bucket; path[0] = root
path
:=
nodePathToPath
(
nodePath
)
path
:=
nodePathToPath
(
nodePath
)
...
@@ -252,10 +251,10 @@ func (δBtail *ΔBtail) Track(key Key, nodePath []Node) error { // XXX Tree|Buck
...
@@ -252,10 +251,10 @@ func (δBtail *ΔBtail) Track(key Key, nodePath []Node) error { // XXX Tree|Buck
tracefΔBtail
(
"trackSet: %s
\n
"
,
δBtail
.
trackSet
)
// XXX locking
tracefΔBtail
(
"trackSet: %s
\n
"
,
δBtail
.
trackSet
)
// XXX locking
}
}
return
δBtail
.
track
(
key
,
path
)
δBtail
.
track
(
key
,
path
)
}
}
func
(
δBtail
*
ΔBtail
)
track
(
key
Key
,
path
[]
zodb
.
Oid
)
error
{
func
(
δBtail
*
ΔBtail
)
track
(
key
Key
,
path
[]
zodb
.
Oid
)
{
// XXX locking
// XXX locking
// first normalize path: remove embedded bucket and check if it was an
// first normalize path: remove embedded bucket and check if it was an
...
@@ -264,7 +263,7 @@ func (δBtail *ΔBtail) track(key Key, path []zodb.Oid) error {
...
@@ -264,7 +263,7 @@ func (δBtail *ΔBtail) track(key Key, path []zodb.Oid) error {
// normalization path[-1] can be InvalidOid.
// normalization path[-1] can be InvalidOid.
path
=
blib
.
NormPath
(
path
)
path
=
blib
.
NormPath
(
path
)
if
len
(
path
)
==
0
{
if
len
(
path
)
==
0
{
return
nil
// empty tree
return
// empty tree
}
}
root
:=
path
[
0
]
root
:=
path
[
0
]
...
@@ -277,7 +276,7 @@ func (δBtail *ΔBtail) track(key Key, path []zodb.Oid) error {
...
@@ -277,7 +276,7 @@ func (δBtail *ΔBtail) track(key Key, path []zodb.Oid) error {
if
!
pathEqual
(
path
,
path_
)
{
if
!
pathEqual
(
path
,
path_
)
{
panicf
(
"BUG: key %s is already tracked via path=%v
\n
track requests path=%v"
,
kstr
(
key
),
path_
,
path
)
panicf
(
"BUG: key %s is already tracked via path=%v
\n
track requests path=%v"
,
kstr
(
key
),
path_
,
path
)
}
}
return
nil
return
}
}
// queue path into trackNew
// queue path into trackNew
...
@@ -290,7 +289,6 @@ func (δBtail *ΔBtail) track(key Key, path []zodb.Oid) error {
...
@@ -290,7 +289,6 @@ func (δBtail *ΔBtail) track(key Key, path []zodb.Oid) error {
δBtail
.
trackNewRoots
.
Add
(
root
)
δBtail
.
trackNewRoots
.
Add
(
root
)
δTtail
.
trackNew
.
AddPath
(
path
)
δTtail
.
trackNew
.
AddPath
(
path
)
tracefΔBtail
(
"->T: [%s].trackNew -> %s
\n
"
,
root
,
δTtail
.
trackNew
)
tracefΔBtail
(
"->T: [%s].trackNew -> %s
\n
"
,
root
,
δTtail
.
trackNew
)
return
nil
}
}
// rebuildAll rebuilds ΔBtail taking all trackNew requests into account.
// rebuildAll rebuilds ΔBtail taking all trackNew requests into account.
...
...
wcfs/internal/xbtree/δbtail_test.go
View file @
6ad0052c
...
@@ -659,7 +659,7 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
...
@@ -659,7 +659,7 @@ func xverifyΔBTail_Update1(t *testing.T, subj string, db *zodb.DB, treeRoot zod
// δbtail @at1 with initial tracked set
// δbtail @at1 with initial tracked set
δbtail
:=
NewΔBtail
(
t1
.
At
,
db
)
δbtail
:=
NewΔBtail
(
t1
.
At
,
db
)
x
trackKeys
(
δbtail
,
t1
,
initialTrackedKeys
)
trackKeys
(
δbtail
,
t1
,
initialTrackedKeys
)
// TrackedδZ = Tracked ^ δZ (i.e. a tracked node has changed, or its coverage was changed)
// TrackedδZ = Tracked ^ δZ (i.e. a tracked node has changed, or its coverage was changed)
TrackedδZ
=
setKey
{}
TrackedδZ
=
setKey
{}
...
@@ -1047,7 +1047,7 @@ func xverifyΔBTail_rebuild_TR(t *testing.T, δbtail *ΔBtail, tj *xbtreetest.Co
...
@@ -1047,7 +1047,7 @@ func xverifyΔBTail_rebuild_TR(t *testing.T, δbtail *ΔBtail, tj *xbtreetest.Co
ø
:=
blib
.
PPTreeSubSet
{}
ø
:=
blib
.
PPTreeSubSet
{}
// Track(keys)
// Track(keys)
x
trackKeys
(
δbtail
,
tj
,
keys
)
trackKeys
(
δbtail
,
tj
,
keys
)
subj
:=
fmt
.
Sprintf
(
"@%s: after Track%v"
,
xat
[
tj
.
At
],
keys
)
subj
:=
fmt
.
Sprintf
(
"@%s: after Track%v"
,
xat
[
tj
.
At
],
keys
)
δbtail
.
assertTrack
(
t
,
subj
,
trackSet
,
trackNew
)
δbtail
.
assertTrack
(
t
,
subj
,
trackSet
,
trackNew
)
...
@@ -1173,7 +1173,7 @@ func TestΔBtailForget(t_ *testing.T) {
...
@@ -1173,7 +1173,7 @@ func TestΔBtailForget(t_ *testing.T) {
// start tracking. everything becomes tracked because t1's T/B1:a has [-∞,∞) coverage
// start tracking. everything becomes tracked because t1's T/B1:a has [-∞,∞) coverage
// By starting tracking after t2 we verify vδBroots update in both Update and rebuild
// By starting tracking after t2 we verify vδBroots update in both Update and rebuild
_0
:=
setKey
{};
_0
.
Add
(
0
)
_0
:=
setKey
{};
_0
.
Add
(
0
)
x
trackKeys
(
δbtail
,
t2
,
_0
)
trackKeys
(
δbtail
,
t2
,
_0
)
_
,
err
=
δbtail
.
Update
(
t3
.
ΔZ
);
X
(
err
)
_
,
err
=
δbtail
.
Update
(
t3
.
ΔZ
);
X
(
err
)
...
@@ -1233,7 +1233,7 @@ func TestΔBtailSliceByRootRev(t_ *testing.T) {
...
@@ -1233,7 +1233,7 @@ func TestΔBtailSliceByRootRev(t_ *testing.T) {
// track 2 + rebuild.
// track 2 + rebuild.
_2
:=
setKey
{};
_2
.
Add
(
2
)
_2
:=
setKey
{};
_2
.
Add
(
2
)
x
trackKeys
(
δbtail
,
t2
,
_2
)
trackKeys
(
δbtail
,
t2
,
_2
)
err
=
δbtail
.
rebuildAll
();
X
(
err
)
err
=
δbtail
.
rebuildAll
();
X
(
err
)
δttail
:=
δbtail
.
vδTbyRoot
[
t
.
Root
()]
δttail
:=
δbtail
.
vδTbyRoot
[
t
.
Root
()]
...
@@ -1300,7 +1300,7 @@ func TestΔBtailSliceByRootRev(t_ *testing.T) {
...
@@ -1300,7 +1300,7 @@ func TestΔBtailSliceByRootRev(t_ *testing.T) {
// after track 1 + rebuild old slices remain unchanged, but new queries return updated data
// after track 1 + rebuild old slices remain unchanged, but new queries return updated data
_1
:=
setKey
{};
_1
.
Add
(
1
)
_1
:=
setKey
{};
_1
.
Add
(
1
)
x
trackKeys
(
δbtail
,
t2
,
_1
)
trackKeys
(
δbtail
,
t2
,
_1
)
err
=
δbtail
.
rebuildAll
();
X
(
err
)
err
=
δbtail
.
rebuildAll
();
X
(
err
)
s00_
:=
δbtail
.
SliceByRootRev
(
t
.
Root
(),
t0
.
At
,
t0
.
At
)
s00_
:=
δbtail
.
SliceByRootRev
(
t
.
Root
(),
t0
.
At
,
t0
.
At
)
...
@@ -1365,7 +1365,7 @@ func TestΔBtailClone(t_ *testing.T) {
...
@@ -1365,7 +1365,7 @@ func TestΔBtailClone(t_ *testing.T) {
δbtail
:=
NewΔBtail
(
t0
.
At
,
t
.
DB
)
δbtail
:=
NewΔBtail
(
t0
.
At
,
t
.
DB
)
_
,
err
:=
δbtail
.
Update
(
t1
.
ΔZ
);
X
(
err
)
_
,
err
:=
δbtail
.
Update
(
t1
.
ΔZ
);
X
(
err
)
_2
:=
setKey
{};
_2
.
Add
(
2
)
_2
:=
setKey
{};
_2
.
Add
(
2
)
x
trackKeys
(
δbtail
,
t1
,
_2
)
trackKeys
(
δbtail
,
t1
,
_2
)
err
=
δbtail
.
rebuildAll
();
X
(
err
)
err
=
δbtail
.
rebuildAll
();
X
(
err
)
xat
:=
map
[
zodb
.
Tid
]
string
{
xat
:=
map
[
zodb
.
Tid
]
string
{
...
@@ -1692,9 +1692,8 @@ func _trackSetWithCov(rbs xbtreetest.RBucketSet, tracked setKey, outKeyCover *bl
...
@@ -1692,9 +1692,8 @@ func _trackSetWithCov(rbs xbtreetest.RBucketSet, tracked setKey, outKeyCover *bl
}
}
// xtrackKeys issues δbtail.Track requests for tree[keys].
// trackKeys issues δbtail.Track requests for tree[keys].
func
xtrackKeys
(
δbtail
*
ΔBtail
,
t
*
xbtreetest
.
Commit
,
keys
setKey
)
{
func
trackKeys
(
δbtail
*
ΔBtail
,
t
*
xbtreetest
.
Commit
,
keys
setKey
)
{
X
:=
exc
.
Raiseif
head
:=
δbtail
.
Head
()
head
:=
δbtail
.
Head
()
if
head
!=
t
.
At
{
if
head
!=
t
.
At
{
panicf
(
"BUG: δbtail.head: %s ; t.at: %s"
,
head
,
t
.
At
)
panicf
(
"BUG: δbtail.head: %s ; t.at: %s"
,
head
,
t
.
At
)
...
@@ -1712,7 +1711,7 @@ func xtrackKeys(δbtail *ΔBtail, t *xbtreetest.Commit, keys setKey) {
...
@@ -1712,7 +1711,7 @@ func xtrackKeys(δbtail *ΔBtail, t *xbtreetest.Commit, keys setKey) {
// tracking set. By aligning initial state to the same as after
// tracking set. By aligning initial state to the same as after
// T1->ø, we test what will happen on ø->T2.
// T1->ø, we test what will happen on ø->T2.
b
:=
t
.
Xkv
.
Get
(
k
)
b
:=
t
.
Xkv
.
Get
(
k
)
err
:=
δbtail
.
track
(
k
,
b
.
Path
());
X
(
err
)
δbtail
.
track
(
k
,
b
.
Path
()
)
}
}
}
}
...
...
wcfs/internal/zdata/δftail.go
View file @
6ad0052c
...
@@ -182,10 +182,7 @@ func (δFtail *ΔFtail) Track(file *ZBigFile, blk int64, path []btree.LONode, zb
...
@@ -182,10 +182,7 @@ func (δFtail *ΔFtail) Track(file *ZBigFile, blk int64, path []btree.LONode, zb
// XXX blk = ∞ from beginning ?
// XXX blk = ∞ from beginning ?
blk
=
xbtree
.
KeyMax
blk
=
xbtree
.
KeyMax
}
}
err
:=
δFtail
.
δBtail
.
Track
(
blk
,
path
)
δFtail
.
δBtail
.
Track
(
blk
,
path
)
if
err
!=
nil
{
panic
(
err
)
// XXX -> error? errctx
}
root
:=
path
[
0
]
.
(
*
btree
.
LOBTree
)
root
:=
path
[
0
]
.
(
*
btree
.
LOBTree
)
roid
:=
root
.
POid
()
roid
:=
root
.
POid
()
...
...
Kirill Smelkov
@kirr
mentioned in commit
305d897b
·
Oct 27, 2021
mentioned in commit
305d897b
mentioned in commit 305d897b15ac0866de464de36b34c1fe1de90a63
Toggle commit list
Kirill Smelkov
@kirr
mentioned in commit
2ab4be93
·
Oct 28, 2021
mentioned in commit
2ab4be93
mentioned in commit 2ab4be938541c61bf881216bdffc5376241ccc30
Toggle commit list
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