Commit 83b604f6 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a1b94828
......@@ -932,7 +932,7 @@ func (f *BigFile) invalidateBlk(ctx context.Context, blk int64) (err error) {
if int64(len(blkdata)) == blksize {
func() {
// store retrieved data back to OS cache for file @<rev>/file[blk]
blkrev, _ := f.δtail.LastRevOf(blk, f.head.zconn.At())
blkrev, _ := f.LastBlkRev(blk, f.head.zconn.At())
frev, frelease, err := groot.mkrevfile(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)
......@@ -1159,7 +1159,7 @@ func (f *BigFile) updateWatchers(ctx context.Context, blk int64, treepath []btre
bfdir.δFtail.Track(f, treepath)
bfdir.δFmu.Unlock()
blkrevmax, _ := f.δtail.LastRevOf(blk, f.zfile.PJar().At()) // XXX = f.head.zconn.At()
blkrevmax, _ := f.LastBlkRev(blk, f.head.zconn.At())
blkrevmax = tidmin(blkrevmax, pathRevMax)
wg, ctx := errgroup.WithContext(ctx)
......@@ -1271,7 +1271,7 @@ func (w *Watch) pin(ctx context.Context, blk int64, rev zodb.Tid) (err error) {
// XXX comment
// XXX file.δtail has not full info
rev, _ = w.file.δtail.LastRevOf(blk, w.at)
rev, _ = w.file.LastBlkRev(blk, w.at)
ack, err := w.link.sendReq(ctx, fmt.Sprintf("pin %s #%d @%s", foid, blk, rev))
if err != nil {
......@@ -1305,7 +1305,8 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
// watch was not previously established - set it up anew
// XXX locking
f := wlink.head.bfdir.fileTab[foid]
bfdir := wlink.head.bfdir
f := bfdir.fileTab[foid]
if f == nil {
// by "invalidation protocol" watch is setup after data file was opened
return fmt.Errorf("file not yet known or is not a ZBigFile")
......@@ -1316,13 +1317,14 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
// XXX locking
if at < f.δtail.Tail() {
if at < bfdir.δFtail.Tail() {
// XXX err += head.at?
return fmt.Errorf("at is too far away back from head/at")
}
toPin := map[int64]zodb.Tid{} // blk -> @rev
/* XXX reenable
// XXX f.δtail.Head() not neccessarily = head.At()
// (if f was not changed by a txn, f.δtail stays not updated) XXX correct?
//
......@@ -1338,9 +1340,10 @@ func (wlink *WatchLink) setupWatch(ctx context.Context, foid zodb.Oid, at zodb.T
}
// FIXME (!!!) again f.δtail can miss some entries
toPin[blk], _ = f.δtail.LastRevOf(blk, at)
toPin[blk], _ = f.LastBlkRev(blk, at)
}
}
*/
wg, ctx := errgroup.WithContext(ctx)
for blk, rev := range toPin {
......
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