filer: fall back to range fetch when a chunk exceeds the reader budget

A ciphered or compressed chunk larger than readerCacheSizeMB can never
be read through the whole-chunk path — the budget rejects the buffer —
so its partial views must still range-fetch or the GET fails outright.
This commit is contained in:
Chris Lu committed 2026-10-03 14:59:36 +08:00
1 parent 1f15e7865a
commit 495e24a476
4 files changed
+52 -5

No files matched your search

+3 -2
View File
@@ -100,11 +100,12 @@ func (rc *ReaderCache) MaybeCache(chunkViews *Interval[*ChunkView], count int) {
// abort when slots are filled
return
}
if chunkView.CanRangeFetch() && !chunkView.IsFullChunk() {
if (chunkView.CanRangeFetch() || !rc.budget.canFit(int(chunkView.ChunkSize))) && !chunkView.IsFullChunk() {
// the view is clipped to part of the chunk and will be
// range-fetched, so prefetching it whole would download bytes
// nobody needs; a ciphered or compressed partial view needs
// the whole blob anyway and is worth prefetching
// the whole blob anyway and is worth prefetching, but not when
// it cannot fit the budget at all
continue
}