ReadAt may return io.EOF t end of file

related to https://github.com/seaweedfs/seaweedfs/issues/6219
This commit is contained in:
chrislu
2024-11-21 00:37:38 -08:00
parent be09d08eb6
commit c9f3448692
11 changed files with 73 additions and 21 deletions

View File

@@ -2,6 +2,7 @@ package erasure_coding
import (
"fmt"
"io"
"os"
"path"
"strconv"
@@ -93,6 +94,10 @@ func (shard *EcVolumeShard) Destroy() {
func (shard *EcVolumeShard) ReadAt(buf []byte, offset int64) (int, error) {
return shard.ecdFile.ReadAt(buf, offset)
n, err := shard.ecdFile.ReadAt(buf, offset)
if err == io.EOF && n == len(buf) {
err = nil
}
return n, err
}