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
ae2730be
Commit
ae2730be
authored
Jun 19, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
b71c111b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
9 deletions
+40
-9
wcfs/wcfs.go
wcfs/wcfs.go
+3
-3
wcfs/δbtail.go
wcfs/δbtail.go
+29
-3
wcfs/δbtail_test.go
wcfs/δbtail_test.go
+1
-1
wcfs/δftail.go
wcfs/δftail.go
+7
-2
No files found.
wcfs/wcfs.go
View file @
ae2730be
...
...
@@ -932,7 +932,7 @@ retry:
}
file
.
size
=
size
bfdir
.
δFtail
.
Track
(
file
,
-
1
,
sizePath
,
nil
)
bfdir
.
δFtail
.
Track
(
ctx
,
file
,
-
1
,
sizePath
,
nil
)
// XXX we can miss a change to file if δblk is not yet tracked
// -> need to update file.rev at read time -> locking=XXX
...
...
@@ -1469,7 +1469,7 @@ func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, treepath []btr
bfdir
:=
f
.
head
.
bfdir
δFtail
:=
bfdir
.
δFtail
bfdir
.
δFmu
.
Lock
()
// XXX locking correct? XXX -> better push down?
δFtail
.
Track
(
f
,
blk
,
treepath
,
zblk
)
// XXX pass in zblk.rev here?
δFtail
.
Track
(
ctx
,
f
,
blk
,
treepath
,
zblk
)
// XXX pass in zblk.rev here?
bfdir
.
δFmu
.
Unlock
()
// make sure that file[blk] on clients side stays as of @w.at state.
...
...
@@ -2156,7 +2156,7 @@ func (head *Head) bigopen(ctx context.Context, oid zodb.Oid) (_ *BigFile, err er
// only head/ needs δFtail, f.δtail and watches.
if
head
.
rev
==
0
{
head
.
bfdir
.
δFmu
.
Lock
()
// XXX locking ok?
head
.
bfdir
.
δFtail
.
Track
(
f
,
-
1
,
sizePath
,
nil
)
head
.
bfdir
.
δFtail
.
Track
(
ctx
,
f
,
-
1
,
sizePath
,
nil
)
head
.
bfdir
.
δFmu
.
Unlock
()
// FIXME: scan zfile.blktab - so that we can detect all btree changes
...
...
wcfs/δbtail.go
View file @
ae2730be
...
...
@@ -227,8 +227,12 @@ const (
// XXX TrackMinKey (we don't need it in WCFS)
)
// XXX kill keyPresent
func
(
δBtail
*
ΔBtail
)
Track
(
key
Key
,
keyPresent
bool
,
path
[]
Node
,
flags
TrackFlags
)
{
// XXX Tree|Bucket; path[0] = root
// XXX kill keyPresent?
// XXX keep in trackedKeys only keys that are not present in btree - i.e. only negative entries
// -> this requires to merge δc returned by diffT and adjust bChildren to tail into
// -> it will use less memory and offload Track from (re)loading leaf bucket
// ... for now we go more simple way
func
(
δBtail
*
ΔBtail
)
Track
(
ctx
context
.
Context
,
key
Key
,
keyPresent
bool
,
path
[]
Node
,
flags
TrackFlags
)
error
{
// XXX Tree|Bucket; path[0] = root
l
:=
len
(
path
)
if
l
==
0
{
panic
(
"empty path"
)
...
...
@@ -272,8 +276,29 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node, flags Track
// tracked += all keys of leaf bucket for every node up to the root
fmt
.
Printf
(
" oldTrack: %v leafBucket: %v
\n
"
,
oldTrack
,
leafBucket
)
if
!
oldTrack
&&
leafBucket
!=
nil
{
// activate leaf node to get access to its data
if
leafBucket
.
POid
()
!=
zodb
.
InvalidOid
{
// normal bucket
err
:=
leafBucket
.
PActivate
(
ctx
)
if
err
!=
nil
{
return
err
}
defer
leafBucket
.
PDeactivate
()
}
else
{
// bucket embedded into tree
// XXX assert len(path) == 2
err
:=
treeRoot
.
PActivate
(
ctx
)
if
err
!=
nil
{
return
err
}
defer
treeRoot
.
PActivate
(
ctx
)
// XXX assert len(treeRoot.Entryv()) == 1
// XXX assert [0] is Bucket && POid == zodb.InvalidOid
leafBucket
=
treeRoot
.
Entryv
()[
0
]
.
Child
()
.
(
*
Bucket
)
// because it is recreated
}
bkeys
:=
SetKey
{}
for
_
,
__
:=
range
leafBucket
.
Entryv
()
{
// XXX activate
for
_
,
__
:=
range
leafBucket
.
Entryv
()
{
bkeys
.
Add
(
__
.
Key
())
}
fmt
.
Printf
(
" bkeys: %s
\n
"
,
bkeys
)
...
...
@@ -302,6 +327,7 @@ func (δBtail *ΔBtail) Track(key Key, keyPresent bool, path []Node, flags Track
// XXX update diff XXX here? or as separate step?
// XXX update lastRevOf
return
nil
}
// Update updates δB with per-object level ZODB changes.
...
...
wcfs/δbtail_test.go
View file @
ae2730be
...
...
@@ -548,7 +548,7 @@ func xverifyΔBTail1(t *testing.T, subj string, db *zodb.DB, treeRoot zodb.Oid,
if
k
==
kInf
{
trackFlags
=
TrackMaxKey
}
δbtail
.
Track
(
k
,
ok
,
path
,
trackFlags
)
err
=
δbtail
.
Track
(
ctx
,
k
,
ok
,
path
,
trackFlags
);
X
(
err
)
kadjTracked
.
Update
(
kadj
[
k
])
}
...
...
wcfs/δftail.go
View file @
ae2730be
...
...
@@ -136,13 +136,18 @@ func (δFtail *ΔFtail) Tail() zodb.Tid { return δFtail.δBtail.Tail() }
// XXX text
//
// A root can be associated with several files (each provided on different Track call).
func
(
δFtail
*
ΔFtail
)
Track
(
file
*
BigFile
,
blk
int64
,
path
[]
btree
.
LONode
,
zblk
zBlk
)
{
//
// XXX try to avoid ctx
func
(
δFtail
*
ΔFtail
)
Track
(
ctx
context
.
Context
,
file
*
BigFile
,
blk
int64
,
path
[]
btree
.
LONode
,
zblk
zBlk
)
{
δbTrackFlags
:=
TrackFlags
(
0
)
if
blk
==
-
1
{
// XXX blk = ∞ ?
δbTrackFlags
=
TrackMaxKey
}
δFtail
.
δBtail
.
Track
(
blk
,
zblk
!=
nil
,
path
,
δbTrackFlags
)
err
:=
δFtail
.
δBtail
.
Track
(
ctx
,
blk
,
zblk
!=
nil
,
path
,
δbTrackFlags
)
if
err
!=
nil
{
panic
(
err
)
// XXX -> error? errctx
}
root
:=
path
[
0
]
.
(
*
btree
.
LOBTree
)
files
,
ok
:=
δFtail
.
fileIdx
[
root
.
POid
()]
if
!
ok
{
...
...
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