mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-19 12:27:58 +08:00
volume server: accept fsync=true in write requests
This commit is contained in:
@@ -22,8 +22,10 @@ func ReplicatedWrite(masterNode string, s *storage.Store, volumeId needle.Volume
|
||||
//check JWT
|
||||
jwt := security.GetJwt(r)
|
||||
|
||||
// check whether this is a replicated write request
|
||||
var remoteLocations []operation.Location
|
||||
if r.FormValue("type") != "replicate" {
|
||||
// this is the initial request
|
||||
remoteLocations, err = getWritableRemoteReplications(s, volumeId, masterNode)
|
||||
if err != nil {
|
||||
glog.V(0).Infoln(err)
|
||||
@@ -31,8 +33,14 @@ func ReplicatedWrite(masterNode string, s *storage.Store, volumeId needle.Volume
|
||||
}
|
||||
}
|
||||
|
||||
// read fsync value
|
||||
fsync := false
|
||||
if r.FormValue("fsync") == "true" {
|
||||
fsync = true
|
||||
}
|
||||
|
||||
if s.GetVolume(volumeId) != nil {
|
||||
isUnchanged, err = s.WriteVolumeNeedle(volumeId, n)
|
||||
isUnchanged, err = s.WriteVolumeNeedle(volumeId, n, fsync)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("failed to write to local disk: %v", err)
|
||||
glog.V(0).Infoln(err)
|
||||
|
Reference in New Issue
Block a user