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.

mount: random read also try to use the local cache first

chrisluf2f0482dd332
diff --git a/weed/filer/reader_at.go b/weed/filer/reader_at.go
index 7d99977617..b938083d84 100644
--- a/weed/filer/reader_at.go
+++ b/weed/filer/reader_at.go
@@ -164,6 +164,10 @@ func (c *ChunkReadAt) doReadAt(p []byte, offset int64) (n int, err error) {
func (c *ChunkReadAt) readChunkSliceAt(buffer []byte, chunkView *ChunkView, nextChunkViews []*ChunkView, offset uint64) (n int, err error) {
if c.readerPattern.IsRandomMode() {
+ n, err := c.readerCache.chunkCache.ReadChunkAt(buffer, chunkView.FileId, offset)
+ if n > 0 {
+ return n, err
+ }
return fetchChunkRange(buffer, c.readerCache.lookupFileIdFn, chunkView.FileId, chunkView.CipherKey, chunkView.IsGzipped, int64(offset))
}