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
c4532d1a
Commit
c4532d1a
authored
Apr 22, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
81b5056a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
17 deletions
+67
-17
wcfs/wcfs.go
wcfs/wcfs.go
+9
-8
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+3
-0
wcfs/δbtail.go
wcfs/δbtail.go
+1
-0
wcfs/δftail.go
wcfs/δftail.go
+54
-9
No files found.
wcfs/wcfs.go
View file @
c4532d1a
...
...
@@ -806,8 +806,8 @@ retry:
// XXX no indexMu lock needed because head is Locked
δF
:=
bfdir
.
δFtail
.
Update
(
δZ
,
zhead
)
fmt
.
Printf
(
"
\n\n
zδhandle: δF (#%d):
\n
"
,
len
(
δF
.
Chang
e
))
for
file
,
δfile
:=
range
δF
.
Chang
e
{
fmt
.
Printf
(
"
\n\n
zδhandle: δF (#%d):
\n
"
,
len
(
δF
.
ByFil
e
))
for
file
,
δfile
:=
range
δF
.
ByFil
e
{
blkv
:=
δfile
.
Blocks
.
Elements
()
sort
.
Slice
(
blkv
,
func
(
i
,
j
int
)
bool
{
return
blkv
[
i
]
<
blkv
[
j
]
...
...
@@ -822,7 +822,7 @@ retry:
fmt
.
Printf
(
"
\n\n
"
)
wg
,
ctx
:=
errgroup
.
WithContext
(
context
.
TODO
())
// XXX ctx = ?
for
file
,
δfile
:=
range
δF
.
Chang
e
{
for
file
,
δfile
:=
range
δF
.
ByFil
e
{
// XXX needed?
// XXX even though δBtail is complete, not all ZBlk are present here
file
.
δtail
.
Append
(
δF
.
Rev
,
δfile
.
Blocks
.
Elements
())
...
...
@@ -845,7 +845,7 @@ retry:
//
// do it after completing data invalidations.
wg
,
ctx
=
errgroup
.
WithContext
(
context
.
TODO
())
// XXX ctx = ?
for
file
,
δfile
:=
range
δF
.
Chang
e
{
for
file
,
δfile
:=
range
δF
.
ByFil
e
{
if
!
δfile
.
Size
{
continue
}
...
...
@@ -874,7 +874,7 @@ retry:
// 2. restat invalidated ZBigFile
// XXX -> parallel
// XXX locking
for
file
:=
range
δF
.
Chang
e
{
for
file
:=
range
δF
.
ByFil
e
{
size
,
sizePath
,
err
:=
file
.
zfile
.
Size
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
// XXX
...
...
@@ -1391,9 +1391,10 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
// XXX locking
// pin all tracked file blocks that were changed (at, head] range
fhead
:=
tidmin
(
f
.
δtail
.
Head
(),
headAt
)
for
_
,
δfile
:=
range
f
.
δtail
.
SliceByRev
(
at
,
fhead
)
{
for
_
,
blk
:=
range
δfile
.
Changev
{
// fhead := tidmin(f.δtail.Head(), headAt)
// for _, δfile := range f.δtail.SliceByRev(at, fhead) {
for
_
,
δfile
:=
range
bfdir
.
δFtail
.
SliceByFileRev
(
f
,
at
,
headAt
)
{
for
blk
:=
range
δfile
.
Blocks
{
_
,
already
:=
toPin
[
blk
]
if
already
{
continue
...
...
wcfs/wcfs_test.py
View file @
c4532d1a
...
...
@@ -470,6 +470,9 @@ class tWatch:
#
# expectv is [] of (zf, blk, at)
# returns [] of received pin requests.
#
# XXX cancel waiting upon receiving "ok" from wcfs (-> error that missed pins were not received)
# XXX abort on timeout?
def
expectPin
(
t
,
expectv
):
expected
=
set
()
# of expected pin messages
for
zf
,
blk
,
at
in
expectv
:
...
...
wcfs/δbtail.go
View file @
c4532d1a
...
...
@@ -104,6 +104,7 @@ type ΔBtail struct {
// ΔB represents a change in BTrees space.
type
ΔB
struct
{
Rev
zodb
.
Tid
// XXX -> ByRoot?
Change
map
[
*
Tree
]
map
[
Key
]
Value
// {} root -> {}(key, value)
}
...
...
wcfs/δftail.go
View file @
c4532d1a
...
...
@@ -66,12 +66,16 @@ type ΔFtail struct {
// ΔFtail merge btree.ΔTail with history of ZBlk
δBtail
*
ΔBtail
fileIdx
map
[
*
btree
.
LOBTree
]
SetBigFile
// root -> {} BigFile XXX root -> oid?
// data with δF changes. Actual for part of tracked set that was taken
// into account.
vδF
[]
ΔF
}
// ΔF represents a change in files space.
type
ΔF
struct
{
Rev
zodb
.
Tid
Chang
e
map
[
*
BigFile
]
*
ΔFile
// file -> δfile
ByFil
e
map
[
*
BigFile
]
*
ΔFile
// file -> δfile
}
// ΔFile represents a change to one file.
...
...
@@ -169,7 +173,7 @@ func (δFtail *ΔFtail) Track(file *BigFile, blk int64, path []btree.LONode, zbl
// During call to Update zhead must not be otherwise used - even for reading.
func
(
δFtail
*
ΔFtail
)
Update
(
δZ
*
zodb
.
EventCommit
,
zhead
*
ZConn
)
ΔF
{
δB
:=
δFtail
.
δBtail
.
Update
(
δZ
)
δF
:=
ΔF
{
Rev
:
δB
.
Rev
,
Chang
e
:
make
(
map
[
*
BigFile
]
*
ΔFile
)}
δF
:=
ΔF
{
Rev
:
δB
.
Rev
,
ByFil
e
:
make
(
map
[
*
BigFile
]
*
ΔFile
)}
// take btree changes into account
for
root
,
δt
:=
range
δB
.
Change
{
...
...
@@ -178,10 +182,10 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *ZConn) ΔF {
panicf
(
"ΔFtail: root<%s> -> ø file"
,
root
.
POid
())
}
for
file
:=
range
files
{
δfile
,
ok
:=
δF
.
Chang
e
[
file
]
δfile
,
ok
:=
δF
.
ByFil
e
[
file
]
if
!
ok
{
δfile
=
&
ΔFile
{
Rev
:
δF
.
Rev
,
Blocks
:
make
(
SetI64
)}
δF
.
Chang
e
[
file
]
=
δfile
δF
.
ByFil
e
[
file
]
=
δfile
}
for
blk
/*, zblk*/
:=
range
δt
{
// FIXME stub - need to take both keys and zblk changes into account
...
...
@@ -215,10 +219,10 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *ZConn) ΔF {
// is mutating z.infile. XXX recheck
z
:=
obj
.
inΔFtail
()
for
file
,
blocks
:=
range
z
.
infile
{
δfile
,
ok
:=
δF
.
Chang
e
[
file
]
δfile
,
ok
:=
δF
.
ByFil
e
[
file
]
if
!
ok
{
δfile
=
&
ΔFile
{
Rev
:
δF
.
Rev
,
Blocks
:
make
(
SetI64
)}
δF
.
Chang
e
[
file
]
=
δfile
δF
.
ByFil
e
[
file
]
=
δfile
}
δfile
.
Blocks
.
Update
(
blocks
)
...
...
@@ -238,6 +242,7 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *ZConn) ΔF {
runtime
.
KeepAlive
(
obj
)
}
δFtail
.
vδF
=
append
(
δFtail
.
vδF
,
δF
)
return
δF
}
...
...
@@ -262,9 +267,44 @@ func (δFtail *ΔFtail) SliceByRev(lo, hi zodb.Tid) /*readonly*/ []ΔF {
// the caller must not modify returned slice.
//
// Note: contrary to regular go slicing, low is exclusive while high is inclusive.
func
(
δFtail
*
ΔFtail
)
SliceByFileRev
(
file
*
BigFile
,
lo
,
hi
zodb
.
Tid
)
/*readonly*/
[]
ΔFile
{
func
(
δFtail
*
ΔFtail
)
SliceByFileRev
(
file
*
BigFile
,
lo
,
hi
zodb
.
Tid
)
/*readonly*/
[]
*
ΔFile
{
δassertSlice
(
δFtail
,
lo
,
hi
)
// find vδF range corresponding to (lo, hi]
// XXX linear scan
vδF
:=
δFtail
.
vδF
if
len
(
vδF
)
==
0
{
return
nil
}
// find max j : [j].rev ≤ hi XXX linear scan -> binary search
j
:=
len
(
vδF
)
-
1
for
;
j
>=
0
&&
vδF
[
j
]
.
Rev
>
hi
;
j
--
{}
if
j
<
0
{
return
nil
// ø
}
// find max i : [i].rev > low XXX linear scan -> binary search
i
:=
j
for
;
i
>=
0
&&
vδF
[
i
]
.
Rev
>
lo
;
i
--
{}
i
++
vδF
=
vδF
[
i
:
j
+
1
]
// filter found changed to have only file-related bits
var
vδfile
[]
*
ΔFile
for
_
,
δF
:=
range
vδF
{
δfile
,
ok
:=
δF
.
ByFile
[
file
]
if
ok
{
vδfile
=
append
(
vδfile
,
δfile
)
}
}
// XXX merge into vδF zblk from not yet handled tracked part
return
vδfile
// merging tree (δT) and Zblk (δZblk) histories into file history (δFile):
// δT ────────·──────────────·─────────────────·────────────
...
...
@@ -278,10 +318,15 @@ func (δFtail *ΔFtail) SliceByFileRev(file *BigFile, lo, hi zodb.Tid) /*readonl
//
// δFile ────────o───────o──────x─────x────────────────────────
/*
vδZ := δFtail.δBtail.δZtail.SliceByRev(lo, hi)
_
=
vδZ
panic
(
"TODO"
)
// XXX stub that takes only ZBlk changes into account
// XXX dumb
for _, δZ := range vδZ {
}
*/
/*
// XXX activate zfile?
...
...
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