Commit b4137415 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 3aff490b
...@@ -257,10 +257,10 @@ package main ...@@ -257,10 +257,10 @@ package main
// 2) head/bigfile/* of all bigfiles represent state as of zhead.At . // 2) head/bigfile/* of all bigfiles represent state as of zhead.At .
// 3) for head/bigfile/* the following invariant is maintained: // 3) for head/bigfile/* the following invariant is maintained:
// //
// #blk ∈ OS file cache => ZBlk(#blk) + all BTree/Bucket that lead to it ∈ zhead cache(%) // #blk ∈ OS file cache => ZBlk(#blk) + all BTree/Bucket that lead to it ∈ zhead live cache(%)
// (ZBlk* in ghost state) // (ZBlk* in ghost state)
// //
// => all BTree/Bucket that lead to blk are tracked (XXX) // => all BTree/Bucket that lead to blk are tracked (XXX)
// //
// The invariant helps on invalidation: if we see a changed oid, and // The invariant helps on invalidation: if we see a changed oid, and
// zhead.cache.lookup(oid) = ø -> we know we don't have to invalidate OS // zhead.cache.lookup(oid) = ø -> we know we don't have to invalidate OS
...@@ -848,22 +848,24 @@ retry: ...@@ -848,22 +848,24 @@ retry:
// invalidate kernel cache for data in changed files // invalidate kernel cache for data in changed files
// NOTE no δFmu lock needed because zhead is WLocked // NOTE no δFmu lock needed because zhead is WLocked
δF := bfdir.δFtail.Update(δZ, zhead)
if false { δF := bfdir.δFtail.Update(δZ, zhead) // δF <- δZ |tracked
fmt.Printf("\n\nS: handleδZ: δF (#%d):\n", len(δF.ByFile))
for file, δfile := range δF.ByFile { if false { // XXX -> V(2) ?
blkv := δfile.Blocks.Elements() // debug dump δF
sort.Slice(blkv, func(i, j int) bool { fmt.Printf("\n\nS: handleδZ: δF (#%d):\n", len(δF.ByFile))
return blkv[i] < blkv[j] for file, δfile := range δF.ByFile {
}) blkv := δfile.Blocks.Elements()
size := " " sort.Slice(blkv, func(i, j int) bool {
if δfile.Size { return blkv[i] < blkv[j]
size = "S" })
size := " "
if δfile.Size {
size = "S"
}
fmt.Printf("S: \t- %s\t%s %v\n", file.zfile.POid(), size, blkv)
} }
fmt.Printf("S: \t- %s\t%s %v\n", file.zfile.POid(), size, blkv) fmt.Printf("\n\n")
}
fmt.Printf("\n\n")
} }
wg := xsync.NewWorkGroup(ctx) wg := xsync.NewWorkGroup(ctx)
...@@ -876,7 +878,7 @@ retry: ...@@ -876,7 +878,7 @@ retry:
for blk := range δfile.Blocks { for blk := range δfile.Blocks {
blk := blk blk := blk
wg.Go(func(ctx context.Context) error { wg.Go(func(ctx context.Context) error {
return file.invalidateBlk(ctx, blk) // XXX +ctx ? return file.invalidateBlk(ctx, blk)
}) })
} }
} }
...@@ -1472,7 +1474,9 @@ func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, treepath []btr ...@@ -1472,7 +1474,9 @@ func (f *BigFile) readPinWatchers(ctx context.Context, blk int64, treepath []btr
// fmt.Printf("S: read #%d -> pin watchers (#%d)\n", blk, len(f.watchTab)) // fmt.Printf("S: read #%d -> pin watchers (#%d)\n", blk, len(f.watchTab))
// update δFtail index // update δFtail index XXX -> move upper into readBlk ?
// (δFtail is just for δZ -> δF invalidation handling and is needed without isolation protocol)
// XXX ^^^ no - also need to query to send pins
bfdir := f.head.bfdir bfdir := f.head.bfdir
bfdir.δFmu.Lock() // XXX locking correct? XXX -> better push down? bfdir.δFmu.Lock() // XXX locking correct? XXX -> better push down?
bfdir.δFtail.Track(f, blk, treepath, zblk) // XXX pass in zblk.rev here? bfdir.δFtail.Track(f, blk, treepath, zblk) // XXX pass in zblk.rev here?
......
...@@ -459,7 +459,7 @@ func (bf *zBigFileState) PySetState(pystate interface{}) (err error) { ...@@ -459,7 +459,7 @@ func (bf *zBigFileState) PySetState(pystate interface{}) (err error) {
// //
// it also returns: // it also returns:
// //
// - BTree path in .blktab for loaded block, // - BTree path in .blktab to loaded block,
// - max(_.serial for _ in ZBlk(#blk), all BTree/Bucket that lead to ZBlk) // - max(_.serial for _ in ZBlk(#blk), all BTree/Bucket that lead to ZBlk)
// which provides a rough upper-bound estimate for file[blk] revision. // which provides a rough upper-bound estimate for file[blk] revision.
// //
......
...@@ -428,6 +428,7 @@ func (δFtail *ΔFtail) SliceByFileRev(file *BigFile, lo, hi zodb.Tid) /*readonl ...@@ -428,6 +428,7 @@ func (δFtail *ΔFtail) SliceByFileRev(file *BigFile, lo, hi zodb.Tid) /*readonl
} }
// XXX -> ΔFtail.BlkRevAt (meth of ΔFtail, not file)
// XXX -> BlkRevAt // XXX -> BlkRevAt
// LastBlkRev returns last revision that changed file[blk] as of @at database state. // LastBlkRev returns last revision that changed file[blk] as of @at database state.
// //
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment