Skip to content

Commit

Permalink
Fix type assert to *os.File never works for cacheFile (#5615)
Browse files Browse the repository at this point in the history
Signed-off-by: Changxin Miao <[email protected]>
  • Loading branch information
polyrabbit authored Feb 6, 2025
1 parent 32f1f88 commit 00ca507
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkg/chunk/cached_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,8 @@ func (s *rSlice) ReadAt(ctx context.Context, page *Page, off int) (n int, err er
s.store.cacheReadHist.Observe(time.Since(start).Seconds())
return n, nil
}
if f, ok := r.(*os.File); ok {
logger.Warnf("remove partial cached block %s: %d %s", f.Name(), n, err)
_ = os.Remove(f.Name())
}
logger.Warnf("remove partial cached block %s: %d %s", key, n, err)
s.store.bcache.remove(key, false)
}
}

Expand Down Expand Up @@ -462,7 +460,7 @@ func (s *wSlice) upload(indx int) {
stageFailed = true
if !errors.Is(err, errStageConcurrency) {
s.store.stageBlockErrors.Add(1)
logger.Warnf("write %s to disk: %s, upload it directly", stagingPath, err)
logger.Warnf("write %s to disk: %s, upload it directly", key, err)
}
} else {
s.errors <- nil
Expand Down

0 comments on commit 00ca507

Please sign in to comment.