filer: keep ciphered chunks on the whole-chunk path

A range fetch cannot save bytes for a ciphered chunk: readEncryptedUrl
always downloads and decrypts the whole blob before slicing. Sending
partial views of ciphered chunks through fetchChunkRange would repeat the
full download per buffer, so they keep the shared whole-chunk path where
one download serves every buffer. Prefetch stays enabled for them for
the same reason.
This commit is contained in:
Chris Lu committed 2026-10-03 09:38:40 +08:00
1 parent dd75add62f
commit 521a19c567
3 files changed
+27 -10

No files matched your search

+5 -3
View File
@@ -100,9 +100,11 @@ func (rc *ReaderCache) MaybeCache(chunkViews *Interval[*ChunkView], count int) {
// abort when slots are filled
return
}
if !chunkView.IsFullChunk() {
// the view is clipped to part of the chunk, so the rest is never
// read; prefetching it whole would download bytes nobody needs
if chunkView.CipherKey == nil && !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 partial view needs the whole blob
// anyway and is worth prefetching
continue
}