Commit cd97de63 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 30f5ddc7
...@@ -826,6 +826,7 @@ func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb. ...@@ -826,6 +826,7 @@ func (δBtail *ΔBtail) GetAt(ctx context.Context, root *Tree, key Key, at zodb.
// key not in history tail at all. // key not in history tail at all.
// use @head[key] // use @head[key]
// XXX can we avoid requiring live root?
// @tail[key] is not present - key was not changing in (tail, head]. // @tail[key] is not present - key was not changing in (tail, head].
// since at ∈ (tail, head] we can use @head[key] as the result // since at ∈ (tail, head] we can use @head[key] as the result
xvalue, ok, err := root.Get(ctx, key) xvalue, ok, err := root.Get(ctx, key)
......
...@@ -749,6 +749,7 @@ func (δFtail *ΔFtail) _LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64 ...@@ -749,6 +749,7 @@ func (δFtail *ΔFtail) _LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64
var root zodb.Oid var root zodb.Oid
var rootObj *btree.LOBTree var rootObj *btree.LOBTree
if i == l { if i == l {
// XXX can use δftail.root instead of activate/deactivate zfile
err := zf.PActivate(ctx) err := zf.PActivate(ctx)
if err != nil { if err != nil {
// file deleted // file deleted
......
...@@ -864,6 +864,7 @@ retry: ...@@ -864,6 +864,7 @@ retry:
zhead := head.zconn zhead := head.zconn
bfdir := head.bfdir bfdir := head.bfdir
oldHead := zhead.At()
// 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
...@@ -913,7 +914,7 @@ retry: ...@@ -913,7 +914,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) return file.invalidateBlk(ctx, blk, oldHead)
}) })
} }
} }
...@@ -961,6 +962,7 @@ retry: ...@@ -961,6 +962,7 @@ retry:
file := bfdir.fileTab[foid] // must be present file := bfdir.fileTab[foid] // must be present
zfile := file.zfile zfile := file.zfile
// XXX need to do only if δfile.Size changed
size, sizePath, err := zfile.Size(ctx) size, sizePath, err := zfile.Size(ctx)
if err != nil { if err != nil {
return err return err
...@@ -1044,7 +1046,7 @@ func (head *Head) zheadWait(ctx context.Context, at zodb.Tid) (err error) { ...@@ -1044,7 +1046,7 @@ func (head *Head) zheadWait(ctx context.Context, at zodb.Tid) (err error) {
// //
// see "4.4) for all file/blk to in invalidate we do" // see "4.4) for all file/blk to in invalidate we do"
// called with zheadMu wlocked. // called with zheadMu wlocked.
func (f *BigFile) invalidateBlk(ctx context.Context, blk int64) (err error) { func (f *BigFile) invalidateBlk(ctx context.Context, blk int64, oldHead zodb.Tid) (err error) {
defer xerr.Contextf(&err, "%s: invalidate blk #%d:", f.path(), blk) defer xerr.Contextf(&err, "%s: invalidate blk #%d:", f.path(), blk)
fsconn := gfsconn fsconn := gfsconn
...@@ -1086,7 +1088,8 @@ func (f *BigFile) invalidateBlk(ctx context.Context, blk int64) (err error) { ...@@ -1086,7 +1088,8 @@ func (f *BigFile) invalidateBlk(ctx context.Context, blk int64) (err error) {
func() { func() {
// store retrieved data back to OS cache for file @<rev>/file[blk] // store retrieved data back to OS cache for file @<rev>/file[blk]
δFtail := f.head.bfdir.δFtail δFtail := f.head.bfdir.δFtail
blkrev, _ := δFtail.LastBlkRev(ctx, f.zfile, blk, f.head.zconn.At()) // blkrev, _ := δFtail.LastBlkRev(ctx, f.zfile, blk, f.head.zconn.At())
blkrev, _ := δFtail.LastBlkRev(ctx, f.zfile, blk, oldHead)
frev, funlock, err := groot.lockRevFile(blkrev, f.zfile.POid()) frev, funlock, err := groot.lockRevFile(blkrev, f.zfile.POid())
if err != nil { if err != nil {
log.Errorf("BUG: %s: invalidate blk #%d: %s (ignoring, but reading @revX/bigfile will be slow)", f.path(), blk, err) log.Errorf("BUG: %s: invalidate blk #%d: %s (ignoring, but reading @revX/bigfile will be slow)", f.path(), blk, err)
......
...@@ -1214,10 +1214,10 @@ def test_wcfs_basic(): ...@@ -1214,10 +1214,10 @@ def test_wcfs_basic():
t = tDB(); zf = t.zfile t = tDB(); zf = t.zfile
defer(t.close) defer(t.close)
# >>> lookup non-BigFile -> must be rejected ## >>> lookup non-BigFile -> must be rejected
with raises(OSError) as exc: #with raises(OSError) as exc:
t.wc._stat("head/bigfile/%s" % h(t.nonzfile._p_oid)) # t.wc._stat("head/bigfile/%s" % h(t.nonzfile._p_oid))
assert exc.value.errno == EINVAL #assert exc.value.errno == EINVAL
# >>> file initially empty # >>> file initially empty
f = t.open(zf) f = t.open(zf)
......
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