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.
// key not in history tail at all.
// use @head[key]
// XXX can we avoid requiring live root?
// @tail[key] is not present - key was not changing in (tail, head].
// since at ∈ (tail, head] we can use @head[key] as the result
xvalue, ok, err := root.Get(ctx, key)
......
......@@ -749,6 +749,7 @@ func (δFtail *ΔFtail) _LastBlkRev(ctx context.Context, zf *ZBigFile, blk int64
var root zodb.Oid
var rootObj *btree.LOBTree
if i == l {
// XXX can use δftail.root instead of activate/deactivate zfile
err := zf.PActivate(ctx)
if err != nil {
// file deleted
......
......@@ -864,6 +864,7 @@ retry:
zhead := head.zconn
bfdir := head.bfdir
oldHead := zhead.At()
// invalidate kernel cache for data in changed files
// NOTE no δFmu lock needed because zhead is WLocked
......@@ -913,7 +914,7 @@ retry:
for blk := range δfile.Blocks {
blk := blk
wg.Go(func(ctx context.Context) error {
return file.invalidateBlk(ctx, blk)
return file.invalidateBlk(ctx, blk, oldHead)
})
}
}
......@@ -961,6 +962,7 @@ retry:
file := bfdir.fileTab[foid] // must be present
zfile := file.zfile
// XXX need to do only if δfile.Size changed
size, sizePath, err := zfile.Size(ctx)
if err != nil {
return err
......@@ -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"
// 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)
fsconn := gfsconn
......@@ -1086,7 +1088,8 @@ func (f *BigFile) invalidateBlk(ctx context.Context, blk int64) (err error) {
func() {
// store retrieved data back to OS cache for file @<rev>/file[blk]
δ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())
if err != nil {
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():
t = tDB(); zf = t.zfile
defer(t.close)
# >>> lookup non-BigFile -> must be rejected
with raises(OSError) as exc:
t.wc._stat("head/bigfile/%s" % h(t.nonzfile._p_oid))
assert exc.value.errno == EINVAL
## >>> lookup non-BigFile -> must be rejected
#with raises(OSError) as exc:
# t.wc._stat("head/bigfile/%s" % h(t.nonzfile._p_oid))
#assert exc.value.errno == EINVAL
# >>> file initially empty
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