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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
3765bd53
Commit
3765bd53
authored
Apr 22, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
f4e2197d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
17 deletions
+30
-17
wcfs/wcfs.go
wcfs/wcfs.go
+13
-7
wcfs/δftail.go
wcfs/δftail.go
+17
-10
No files found.
wcfs/wcfs.go
View file @
3765bd53
...
@@ -740,12 +740,14 @@ retry:
...
@@ -740,12 +740,14 @@ retry:
zhead
:=
head
.
zconn
zhead
:=
head
.
zconn
bfdir
:=
head
.
bfdir
bfdir
:=
head
.
bfdir
/*
// fileInvalidate describes invalidations for one file
// fileInvalidate describes invalidations for one file
type fileInvalidate struct {
type fileInvalidate struct {
blkmap SetI64 // changed blocks
blkmap SetI64 // changed blocks
size bool // whether to invalidate file size
size bool // whether to invalidate file size
}
}
toinvalidate := map[*BigFile]*fileInvalidate{} // {} file -> set(#blk), sizeChanged
toinvalidate := map[*BigFile]*fileInvalidate{} // {} file -> set(#blk), sizeChanged
*/
// btreeChangev := []zodb.Oid{} // oids changing BTree|Bucket
// btreeChangev := []zodb.Oid{} // oids changing BTree|Bucket
//fmt.Printf("\n\n\n")
//fmt.Printf("\n\n\n")
...
@@ -815,6 +817,7 @@ retry:
...
@@ -815,6 +817,7 @@ retry:
//fmt.Printf("\nbtreeChangev: %v\n", btreeChangev)
//fmt.Printf("\nbtreeChangev: %v\n", btreeChangev)
δF
:=
bfdir
.
δFtail
.
Update
(
δZ
,
zhead
)
δF
:=
bfdir
.
δFtail
.
Update
(
δZ
,
zhead
)
//fmt.Printf("xfiles: %v\n", xfiles)
//fmt.Printf("xfiles: %v\n", xfiles)
/*
for file, δfile := range δF.Change {
for file, δfile := range δF.Change {
finv, ok := toinvalidate[file]
finv, ok := toinvalidate[file]
if !ok {
if !ok {
...
@@ -827,8 +830,9 @@ retry:
...
@@ -827,8 +830,9 @@ retry:
finv.blkmap = δfile // XXX copy?
finv.blkmap = δfile // XXX copy?
file
.
δtail
.
Append
(
δF
.
Rev
,
δfile
.
Elements
())
file.δtail.Append(δF.Rev, δfile.
Blocks.
Elements())
}
}
*/
//fmt.Printf("\n\nzδhandle: toinvalidate (#%d):\n", len(toinvalidate))
//fmt.Printf("\n\nzδhandle: toinvalidate (#%d):\n", len(toinvalidate))
//for file := range toinvalidate {
//for file := range toinvalidate {
...
@@ -836,9 +840,10 @@ retry:
...
@@ -836,9 +840,10 @@ retry:
//}
//}
wg
,
ctx
:=
errgroup
.
WithContext
(
context
.
TODO
())
// XXX ctx = ?
wg
,
ctx
:=
errgroup
.
WithContext
(
context
.
TODO
())
// XXX ctx = ?
for
file
,
finv
:=
range
toinvalidate
{
// for file, finv := range toinvalidate {
for
file
,
δfile
:=
range
δF
.
Change
{
file
:=
file
file
:=
file
for
blk
:=
range
finv
.
blkmap
{
for
blk
:=
range
δfile
.
Blocks
{
blk
:=
blk
blk
:=
blk
wg
.
Go
(
func
()
error
{
wg
.
Go
(
func
()
error
{
return
file
.
invalidateBlk
(
ctx
,
blk
)
return
file
.
invalidateBlk
(
ctx
,
blk
)
...
@@ -855,10 +860,11 @@ retry:
...
@@ -855,10 +860,11 @@ 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
,
finv
:=
range
toinvalidat
e
{
for
file
,
δfile
:=
range
δF
.
Chang
e
{
if
!
finv
.
s
ize
{
if
!
δfile
.
S
ize
{
continue
continue
}
}
file
:=
file
wg
.
Go
(
func
()
error
{
wg
.
Go
(
func
()
error
{
return
file
.
invalidateAttr
()
// XXX pass ctx?
return
file
.
invalidateAttr
()
// XXX pass ctx?
})
})
...
@@ -883,7 +889,7 @@ retry:
...
@@ -883,7 +889,7 @@ retry:
// 2. restat invalidated ZBigFile
// 2. restat invalidated ZBigFile
// XXX -> parallel
// XXX -> parallel
// XXX locking
// XXX locking
for
file
:=
range
toinvalidat
e
{
for
file
:=
range
δF
.
Chang
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
...
@@ -906,7 +912,7 @@ retry:
...
@@ -906,7 +912,7 @@ retry:
}
}
// XXX δFtail.ForgetPast(...)
// XXX δFtail.ForgetPast(...)
// XXX for f in
toinvalidate
: f.δtail.ForgetPast(...)
// XXX for f in
δF
: f.δtail.ForgetPast(...)
}
}
// invalidateBlk invalidates 1 file block in kernel cache.
// invalidateBlk invalidates 1 file block in kernel cache.
...
...
wcfs/δftail.go
View file @
3765bd53
...
@@ -71,13 +71,14 @@ type ΔFtail struct {
...
@@ -71,13 +71,14 @@ type ΔFtail struct {
// Δ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
Change
map
[
*
BigFile
]
SetI64
// file -> δfile (= {}#blk)
Change
map
[
*
BigFile
]
*
ΔFile
// file -> δfile
}
}
// Δ
f
ile represents a change to one file.
// Δ
F
ile represents a change to one file.
type
Δ
f
ile
struct
{
type
Δ
F
ile
struct
{
Rev
zodb
.
Tid
Rev
zodb
.
Tid
Change
SetI64
// changed blocks
Blocks
SetI64
// changed blocks
Size
bool
// whether file size changed
}
}
...
@@ -168,7 +169,7 @@ func (δFtail *ΔFtail) Track(file *BigFile, blk int64, path []btree.LONode, zbl
...
@@ -168,7 +169,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
,
Change
:
make
(
map
[
*
BigFile
]
SetI64
)}
δF
:=
ΔF
{
Rev
:
δB
.
Rev
,
Change
:
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
{
...
@@ -179,14 +180,20 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *ZConn) ΔF {
...
@@ -179,14 +180,20 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *ZConn) ΔF {
for
file
:=
range
files
{
for
file
:=
range
files
{
δfile
,
ok
:=
δF
.
Change
[
file
]
δfile
,
ok
:=
δF
.
Change
[
file
]
if
!
ok
{
if
!
ok
{
δfile
=
make
(
SetI64
)
δfile
=
&
ΔFile
{
Rev
:
δF
.
Rev
,
Blocks
:
make
(
SetI64
)}
δF
.
Change
[
file
]
=
δfile
δF
.
Change
[
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
// XXX document, and in particular how to include atTail
// XXX document, and in particular how to include atTail
δfile
.
Add
(
blk
)
δfile
.
Blocks
.
Add
(
blk
)
}
}
// TODO invalidate .size only if key >= maxkey was changed (size increase),
// or if on the other hand maxkey was deleted (size decrese).
//
// XXX currently we invalidate size on any topology change.
δfile
.
Size
=
true
}
}
}
}
...
@@ -210,11 +217,11 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *ZConn) ΔF {
...
@@ -210,11 +217,11 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *ZConn) ΔF {
for
file
,
blocks
:=
range
z
.
infile
{
for
file
,
blocks
:=
range
z
.
infile
{
δfile
,
ok
:=
δF
.
Change
[
file
]
δfile
,
ok
:=
δF
.
Change
[
file
]
if
!
ok
{
if
!
ok
{
δfile
=
make
(
SetI64
)
δfile
=
&
ΔFile
{
Rev
:
δF
.
Rev
,
Blocks
:
make
(
SetI64
)}
δF
.
Change
[
file
]
=
δfile
δF
.
Change
[
file
]
=
δfile
}
}
δfile
.
Update
(
blocks
)
δfile
.
Blocks
.
Update
(
blocks
)
}
}
// XXX update z.infile according to btree changes
// XXX update z.infile according to btree changes
...
@@ -255,7 +262,7 @@ func (δFtail *ΔFtail) SliceByRev(lo, hi zodb.Tid) /*readonly*/ []ΔF {
...
@@ -255,7 +262,7 @@ 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*/
[]
Δ
f
ile
{
func
(
δFtail
*
ΔFtail
)
SliceByFileRev
(
file
*
BigFile
,
lo
,
hi
zodb
.
Tid
)
/*readonly*/
[]
Δ
F
ile
{
δassertSlice
(
δFtail
,
lo
,
hi
)
δassertSlice
(
δFtail
,
lo
,
hi
)
// merging tree (δT) and Zblk (δZblk) histories into file history (δFile):
// merging tree (δT) and Zblk (δZblk) histories into file history (δFile):
...
...
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