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/storage/types"
"os"
"runtime"
"time"
)
@ -11,6 +12,8 @@ var (
_ BackendStorageFile = &DiskFile{}
)
const isMac = runtime.GOOS == "darwin"
type DiskFile struct {
File *os.File
fullFilePath string
@ -81,6 +84,11 @@ func (df *DiskFile) Name() string {
}
func (df *DiskFile) Sync() error {
return nil
// return df.File.Sync()
if df.File == nil {
return os.ErrInvalid
}
if isMac {
return nil
}
return df.File.Sync()
}