Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

bug fix in the data received from cache processing (#6002)

Eugeniy E. Mikhailovc04edeed6835
diff --git a/weed/util/chunk_cache/chunk_cache.go b/weed/util/chunk_cache/chunk_cache.go
index 158f47cfce..866455a24e 100644
--- a/weed/util/chunk_cache/chunk_cache.go
+++ b/weed/util/chunk_cache/chunk_cache.go
@@ -57,7 +57,7 @@ func (c *TieredChunkCache) ReadChunkAt(data []byte, fileId string, offset uint64
if err != nil {
glog.Errorf("failed to read from memcache: %s", err)
}
- if n >= int(minSize) {
+ if n == int(len(data)) {
return n, nil
}
}
@@ -65,24 +65,24 @@ func (c *TieredChunkCache) ReadChunkAt(data []byte, fileId string, offset uint64
fid, err := needle.ParseFileIdFromString(fileId)
if err != nil {
glog.Errorf("failed to parse file id %s", fileId)
- return n, nil
+ return 0, nil
}
if minSize <= c.onDiskCacheSizeLimit0 {
n, err = c.diskCaches[0].readChunkAt(data, fid.Key, offset)
- if n >= int(minSize) {
+ if n == int(len(data)) {
return
}
}
if minSize <= c.onDiskCacheSizeLimit1 {
n, err = c.diskCaches[1].readChunkAt(data, fid.Key, offset)
- if n >= int(minSize) {
+ if n == int(len(data)) {
return
}
}
{
n, err = c.diskCaches[2].readChunkAt(data, fid.Key, offset)
- if n >= int(minSize) {
+ if n == int(len(data)) {
return
}
}