revert disabling FSync for non Mac (#3814)

This commit is contained in:
Konstantin Lebedev 2022-10-10 19:28:02 +05:00 committed by GitHub
parent 3550692afc
commit 5b28c3f728
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,7 @@ import (
"github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/glog"
. "github.com/seaweedfs/seaweedfs/weed/storage/types" . "github.com/seaweedfs/seaweedfs/weed/storage/types"
"os" "os"
"runtime"
"time" "time"
) )
@ -11,6 +12,8 @@ var (
_ BackendStorageFile = &DiskFile{} _ BackendStorageFile = &DiskFile{}
) )
const isMac = runtime.GOOS == "darwin"
type DiskFile struct { type DiskFile struct {
File *os.File File *os.File
fullFilePath string fullFilePath string
@ -81,6 +84,11 @@ func (df *DiskFile) Name() string {
} }
func (df *DiskFile) Sync() error { func (df *DiskFile) Sync() error {
return nil if df.File == nil {
// return df.File.Sync() return os.ErrInvalid
}
if isMac {
return nil
}
return df.File.Sync()
} }