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

@@ -3,6 +3,7 @@ package backend
import (
"github.com/seaweedfs/seaweedfs/weed/glog"
. "github.com/seaweedfs/seaweedfs/weed/storage/types"
"io"
"os"
"runtime"
"time"
@@ -43,7 +44,11 @@ func (df *DiskFile) ReadAt(p []byte, off int64) (n int, err error) {
if df.File == nil {
return 0, os.ErrClosed
}
return df.File.ReadAt(p, off)
n, err = df.File.ReadAt(p, off)
if err == io.EOF && n == len(p) {
err = nil
}
return
}
func (df *DiskFile) WriteAt(p []byte, off int64) (n int, err error) {