diff --git a/weed/storage/backend/disk_file.go b/weed/storage/backend/disk_file.go index 0dd153d5d..7a3a40977 100644 --- a/weed/storage/backend/disk_file.go +++ b/weed/storage/backend/disk_file.go @@ -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() }