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.

fix fsync logic

chrislud8c574a5ef1a
diff --git a/weed/storage/store.go b/weed/storage/store.go
index b138ef457a..3b2869a2e3 100644
--- a/weed/storage/store.go
+++ b/weed/storage/store.go
@@ -437,7 +437,7 @@ func (s *Store) WriteVolumeNeedle(i needle.VolumeId, n *needle.Needle, checkCook
err = fmt.Errorf("volume %d is read only", i)
return
}
- _, _, isUnchanged, err = v.writeNeedle2(n, checkCookie, fsync && s.isStopping)
+ _, _, isUnchanged, err = v.writeNeedle2(n, checkCookie, fsync || s.isStopping)
return
}
glog.V(0).Infoln("volume", i, "not found!")
diff --git a/weed/storage/volume_write.go b/weed/storage/volume_write.go
index 94496cdf61..cf959b5767 100644
--- a/weed/storage/volume_write.go
+++ b/weed/storage/volume_write.go
@@ -121,7 +121,7 @@ func (v *Volume) writeNeedle2(n *needle.Needle, checkCookie bool, fsync bool) (o
n.Ttl = v.Ttl
}
- if !fsync {
+ if fsync {
return v.syncWrite(n, checkCookie)
} else {
asyncRequest := needle.NewAsyncRequest(n, true)