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.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
properly report io.EOF
Chris Lu85001cbec789
diff --git a/weed/filer2/reader_at.go b/weed/filer2/reader_at.goindex 2894f4a4b9..19821771f6 100644--- a/weed/filer2/reader_at.go+++ b/weed/filer2/reader_at.go@@ -114,7 +114,7 @@ func (c *ChunkReadAt) doReadAt(p []byte, offset int64) (n int, err error) {n += delta}- if offset+int64(n) >= c.fileSize {+ if err == nil && offset+int64(len(p)) > c.fileSize {err = io.EOF}// fmt.Printf("~~~ filled %d, err: %v\n\n", n, err)diff --git a/weed/filer2/reader_at_test.go b/weed/filer2/reader_at_test.goindex f93d7ea117..7377c5dbcf 100644--- a/weed/filer2/reader_at_test.go+++ b/weed/filer2/reader_at_test.go@@ -66,9 +66,9 @@ func TestReaderAt(t *testing.T) {chunkCache: &mockChunkCache{},}- testReadAt(t, readerAt, 0, 10, 10, io.EOF)+ testReadAt(t, readerAt, 0, 10, 10, nil)testReadAt(t, readerAt, 0, 12, 10, io.EOF)- testReadAt(t, readerAt, 2, 8, 8, io.EOF)+ testReadAt(t, readerAt, 2, 8, 8, nil)testReadAt(t, readerAt, 3, 6, 6, nil)}@@ -116,7 +116,7 @@ func TestReaderAt0(t *testing.T) {chunkCache: &mockChunkCache{},}- testReadAt(t, readerAt, 0, 10, 10, io.EOF)+ testReadAt(t, readerAt, 0, 10, 10, nil)testReadAt(t, readerAt, 3, 16, 7, io.EOF)testReadAt(t, readerAt, 3, 5, 5, nil)@@ -144,7 +144,7 @@ func TestReaderAt1(t *testing.T) {chunkCache: &mockChunkCache{},}- testReadAt(t, readerAt, 0, 20, 20, io.EOF)+ testReadAt(t, readerAt, 0, 20, 20, nil)testReadAt(t, readerAt, 1, 7, 7, nil)testReadAt(t, readerAt, 0, 1, 1, nil)testReadAt(t, readerAt, 18, 4, 2, io.EOF)