Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

revert disabling FSync for non Mac (#3814)

Konstantin Lebedev5b28c3f728ce
diff --git a/weed/storage/backend/disk_file.go b/weed/storage/backend/disk_file.go
index 0dd153d5d3..7a3a409775 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()
}