Browse Source

filer: restore fallback to chunkCache when cacher returns no data

Fix critical issue where ReadChunkAt would return 0,nil immediately
if SingleChunkCacher couldn't provide data for the requested offset,
without trying the chunkCache fallback. Now if cacher.readChunkAt
returns n=0 and err=nil, we fall through to try chunkCache.
pull/7627/head
chrislu 7 days ago
parent
commit
404c51b8d5
  1. 8
      weed/filer/reader_cache.go

8
weed/filer/reader_cache.go

@ -99,7 +99,13 @@ func (rc *ReaderCache) ReadChunkAt(ctx context.Context, buffer []byte, fileId st
if cacher, found := rc.downloaders[fileId]; found {
rc.Unlock()
return cacher.readChunkAt(ctx, buffer, offset)
n, err := cacher.readChunkAt(ctx, buffer, offset)
if n > 0 || err != nil {
return n, err
}
// If n=0 and err=nil, the cacher couldn't provide data for this offset.
// Fall through to try chunkCache.
rc.Lock()
}
if shouldCache || rc.lookupFileIdFn == nil {
n, err := rc.chunkCache.ReadChunkAt(buffer, fileId, uint64(offset))

Loading…
Cancel
Save