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