Filer Server API support fsync

fix https://github.com/chrislusf/seaweedfs/issues/2528
This commit is contained in:
chrislu 2021-12-26 17:28:47 -08:00
parent 9f9ef1340c
commit 67b723f74e

View file

@ -63,6 +63,7 @@ func (fs *FilerServer) PostHandler(w http.ResponseWriter, r *http.Request, conte
query.Get("replication"), query.Get("replication"),
query.Get("ttl"), query.Get("ttl"),
query.Get("disk"), query.Get("disk"),
query.Get("fsync"),
query.Get("dataCenter"), query.Get("dataCenter"),
query.Get("rack"), query.Get("rack"),
query.Get("dataNode"), query.Get("dataNode"),
@ -152,12 +153,17 @@ func (fs *FilerServer) detectStorageOption(requestURI, qCollection, qReplication
}, nil }, nil
} }
func (fs *FilerServer) detectStorageOption0(requestURI, qCollection, qReplication string, qTtl string, diskType string, dataCenter, rack, dataNode string) (*operation.StorageOption, error) { func (fs *FilerServer) detectStorageOption0(requestURI, qCollection, qReplication string, qTtl string, diskType string, fsync string, dataCenter, rack, dataNode string) (*operation.StorageOption, error) {
ttl, err := needle.ReadTTL(qTtl) ttl, err := needle.ReadTTL(qTtl)
if err != nil { if err != nil {
glog.Errorf("fail to parse ttl %s: %v", qTtl, err) glog.Errorf("fail to parse ttl %s: %v", qTtl, err)
} }
return fs.detectStorageOption(requestURI, qCollection, qReplication, int32(ttl.Minutes())*60, diskType, dataCenter, rack, dataNode) so, err := fs.detectStorageOption(requestURI, qCollection, qReplication, int32(ttl.Minutes())*60, diskType, dataCenter, rack, dataNode)
if so != nil {
so.Fsync = fsync == "true"
}
return so, err
} }