aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2025-08-03 14:26:15 -0700
committerGitHub <noreply@github.com>2025-08-03 14:26:15 -0700
commit513ac58504a2782d65a313e4154bbc7e8a505995 (patch)
tree372412ca864cb23690797c8bad30f8c88d4b2de8
parent4fb7bbb215605f1be5c3fd2f06d2105921913d0e (diff)
downloadseaweedfs-513ac58504a2782d65a313e4154bbc7e8a505995.tar.xz
seaweedfs-513ac58504a2782d65a313e4154bbc7e8a505995.zip
Filer: fix filer range read (#7078)
* fix filer range read Only return true if we're reading the ENTIRE chunk from the beginning. // This prevents bandwidth amplification when range requests happen to align // with chunk boundaries but don't actually want the full chunk. * Update weed/filer/filechunks.go Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
-rw-r--r--weed/filer/filechunks.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/weed/filer/filechunks.go b/weed/filer/filechunks.go
index 7252169d8..43261a970 100644
--- a/weed/filer/filechunks.go
+++ b/weed/filer/filechunks.go
@@ -178,7 +178,10 @@ func (cv *ChunkView) Clone() IntervalValue {
}
func (cv *ChunkView) IsFullChunk() bool {
- return cv.ViewSize == cv.ChunkSize
+ // IsFullChunk returns true if the view covers the entire chunk from the beginning.
+ // This prevents bandwidth amplification when range requests happen to align
+ // with chunk boundaries but don't actually want the full chunk.
+ return cv.OffsetInChunk == 0 && cv.ViewSize == cv.ChunkSize
}
func ViewFromChunks(ctx context.Context, lookupFileIdFn wdclient.LookupFileIdFunctionType, chunks []*filer_pb.FileChunk, offset int64, size int64) (chunkViews *IntervalList[*ChunkView]) {