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
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:
zhead
:=
head
.
zconn
bfdir
:=
head
.
bfdir
/*
// fileInvalidate describes invalidations for one file
type fileInvalidate struct {
blkmap SetI64 // changed blocks
size bool // whether to invalidate file size
}
toinvalidate := map[*BigFile]*fileInvalidate{} // {} file -> set(#blk), sizeChanged
*/
// btreeChangev := []zodb.Oid{} // oids changing BTree|Bucket
//fmt.Printf("\n\n\n")
...
...
@@ -815,6 +817,7 @@ retry:
//fmt.Printf("\nbtreeChangev: %v\n", btreeChangev)
δF
:=
bfdir
.
δFtail
.
Update
(
δZ
,
zhead
)
//fmt.Printf("xfiles: %v\n", xfiles)
/*
for file, δfile := range δF.Change {
finv, ok := toinvalidate[file]
if !ok {
...
...
@@ -827,8 +830,9 @@ retry:
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))
//for file := range toinvalidate {
...
...
@@ -836,9 +840,10 @@ retry:
//}
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
for
blk
:=
range
finv
.
blkmap
{
for
blk
:=
range
δfile
.
Blocks
{
blk
:=
blk
wg
.
Go
(
func
()
error
{
return
file
.
invalidateBlk
(
ctx
,
blk
)
...
...
@@ -855,10 +860,11 @@ retry:
//
// do it after completing data invalidations.
wg
,
ctx
=
errgroup
.
WithContext
(
context
.
TODO
())
// XXX ctx = ?
for
file
,
finv
:=
range
toinvalidat
e
{
if
!
finv
.
s
ize
{
for
file
,
δfile
:=
range
δF
.
Chang
e
{
if
!
δfile
.
S
ize
{
continue
}
file
:=
file
wg
.
Go
(
func
()
error
{
return
file
.
invalidateAttr
()
// XXX pass ctx?
})
...
...
@@ -883,7 +889,7 @@ retry:
// 2. restat invalidated ZBigFile
// XXX -> parallel
// XXX locking
for
file
:=
range
toinvalidat
e
{
for
file
:=
range
δF
.
Chang
e
{
size
,
sizePath
,
err
:=
file
.
zfile
.
Size
(
ctx
)
if
err
!=
nil
{
panic
(
err
)
// XXX
...
...
@@ -906,7 +912,7 @@ retry:
}
// 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.
...
...
wcfs/δftail.go
View file @
3765bd53
...
...
@@ -71,13 +71,14 @@ type ΔFtail struct {
// ΔF represents a change in files space.
type
ΔF
struct
{
Rev
zodb
.
Tid
Change
map
[
*
BigFile
]
SetI64
// file -> δfile (= {}#blk)
Change
map
[
*
BigFile
]
*
ΔFile
// file -> δfile
}
// Δ
f
ile represents a change to one file.
type
Δ
f
ile
struct
{
// Δ
F
ile represents a change to one file.
type
Δ
F
ile
struct
{
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
// 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
,
Change
:
make
(
map
[
*
BigFile
]
SetI64
)}
δF
:=
ΔF
{
Rev
:
δB
.
Rev
,
Change
:
make
(
map
[
*
BigFile
]
*
ΔFile
)}
// take btree changes into account
for
root
,
δt
:=
range
δB
.
Change
{
...
...
@@ -179,14 +180,20 @@ func (δFtail *ΔFtail) Update(δZ *zodb.EventCommit, zhead *ZConn) ΔF {
for
file
:=
range
files
{
δfile
,
ok
:=
δF
.
Change
[
file
]
if
!
ok
{
δfile
=
make
(
SetI64
)
δfile
=
&
ΔFile
{
Rev
:
δF
.
Rev
,
Blocks
:
make
(
SetI64
)}
δF
.
Change
[
file
]
=
δfile
}
for
blk
/*, zblk*/
:=
range
δt
{
// FIXME stub - need to take both keys and zblk changes into account
// 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 {
for
file
,
blocks
:=
range
z
.
infile
{
δfile
,
ok
:=
δF
.
Change
[
file
]
if
!
ok
{
δfile
=
make
(
SetI64
)
δfile
=
&
ΔFile
{
Rev
:
δF
.
Rev
,
Blocks
:
make
(
SetI64
)}
δF
.
Change
[
file
]
=
δfile
}
δfile
.
Update
(
blocks
)
δfile
.
Blocks
.
Update
(
blocks
)
}
// XXX update z.infile according to btree changes
...
...
@@ -255,7 +262,7 @@ 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*/
[]
Δ
f
ile
{
func
(
δFtail
*
ΔFtail
)
SliceByFileRev
(
file
*
BigFile
,
lo
,
hi
zodb
.
Tid
)
/*readonly*/
[]
Δ
F
ile
{
δassertSlice
(
δFtail
,
lo
,
hi
)
// 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