mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Filer locationPrefix configure does not exec replication #2257
fix https://github.com/chrislusf/seaweedfs/issues/2257
This commit is contained in:
parent
0c66b173a4
commit
7937db52e1
|
@ -54,7 +54,7 @@ func init() {
|
||||||
m.volumeSizeLimitMB = cmdMaster.Flag.Uint("volumeSizeLimitMB", 30*1000, "Master stops directing writes to oversized volumes.")
|
m.volumeSizeLimitMB = cmdMaster.Flag.Uint("volumeSizeLimitMB", 30*1000, "Master stops directing writes to oversized volumes.")
|
||||||
m.volumePreallocate = cmdMaster.Flag.Bool("volumePreallocate", false, "Preallocate disk space for volumes.")
|
m.volumePreallocate = cmdMaster.Flag.Bool("volumePreallocate", false, "Preallocate disk space for volumes.")
|
||||||
// m.pulseSeconds = cmdMaster.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats")
|
// m.pulseSeconds = cmdMaster.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats")
|
||||||
m.defaultReplication = cmdMaster.Flag.String("defaultReplication", "000", "Default replication type if not specified.")
|
m.defaultReplication = cmdMaster.Flag.String("defaultReplication", "", "Default replication type if not specified.")
|
||||||
m.garbageThreshold = cmdMaster.Flag.Float64("garbageThreshold", 0.3, "threshold to vacuum and reclaim spaces")
|
m.garbageThreshold = cmdMaster.Flag.Float64("garbageThreshold", 0.3, "threshold to vacuum and reclaim spaces")
|
||||||
m.whiteList = cmdMaster.Flag.String("whiteList", "", "comma separated Ip addresses having write permission. No limit if empty.")
|
m.whiteList = cmdMaster.Flag.String("whiteList", "", "comma separated Ip addresses having write permission. No limit if empty.")
|
||||||
m.disableHttp = cmdMaster.Flag.Bool("disableHttp", false, "disable http requests, only gRPC operations are allowed.")
|
m.disableHttp = cmdMaster.Flag.Bool("disableHttp", false, "disable http requests, only gRPC operations are allowed.")
|
||||||
|
|
|
@ -89,7 +89,7 @@ func init() {
|
||||||
masterOptions.peers = cmdServer.Flag.String("master.peers", "", "all master nodes in comma separated ip:masterPort list")
|
masterOptions.peers = cmdServer.Flag.String("master.peers", "", "all master nodes in comma separated ip:masterPort list")
|
||||||
masterOptions.volumeSizeLimitMB = cmdServer.Flag.Uint("master.volumeSizeLimitMB", 30*1000, "Master stops directing writes to oversized volumes.")
|
masterOptions.volumeSizeLimitMB = cmdServer.Flag.Uint("master.volumeSizeLimitMB", 30*1000, "Master stops directing writes to oversized volumes.")
|
||||||
masterOptions.volumePreallocate = cmdServer.Flag.Bool("master.volumePreallocate", false, "Preallocate disk space for volumes.")
|
masterOptions.volumePreallocate = cmdServer.Flag.Bool("master.volumePreallocate", false, "Preallocate disk space for volumes.")
|
||||||
masterOptions.defaultReplication = cmdServer.Flag.String("master.defaultReplication", "000", "Default replication type if not specified.")
|
masterOptions.defaultReplication = cmdServer.Flag.String("master.defaultReplication", "", "Default replication type if not specified.")
|
||||||
masterOptions.garbageThreshold = cmdServer.Flag.Float64("garbageThreshold", 0.3, "threshold to vacuum and reclaim spaces")
|
masterOptions.garbageThreshold = cmdServer.Flag.Float64("garbageThreshold", 0.3, "threshold to vacuum and reclaim spaces")
|
||||||
masterOptions.metricsAddress = cmdServer.Flag.String("metrics.address", "", "Prometheus gateway address")
|
masterOptions.metricsAddress = cmdServer.Flag.String("metrics.address", "", "Prometheus gateway address")
|
||||||
masterOptions.metricsIntervalSec = cmdServer.Flag.Int("metrics.intervalSeconds", 15, "Prometheus push interval in seconds")
|
masterOptions.metricsIntervalSec = cmdServer.Flag.Int("metrics.intervalSeconds", 15, "Prometheus push interval in seconds")
|
||||||
|
|
|
@ -116,18 +116,6 @@ func (fs *FilerServer) DeleteHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fs *FilerServer) detectStorageOption(requestURI, qCollection, qReplication string, ttlSeconds int32, diskType, dataCenter, rack string) (*operation.StorageOption, error) {
|
func (fs *FilerServer) detectStorageOption(requestURI, qCollection, qReplication string, ttlSeconds int32, diskType, dataCenter, rack string) (*operation.StorageOption, error) {
|
||||||
collection := util.Nvl(qCollection, fs.option.Collection)
|
|
||||||
replication := util.Nvl(qReplication, fs.option.DefaultReplication)
|
|
||||||
|
|
||||||
// required by buckets folder
|
|
||||||
bucketDefaultReplication, fsync := "", false
|
|
||||||
if strings.HasPrefix(requestURI, fs.filer.DirBucketsPath+"/") {
|
|
||||||
collection = fs.filer.DetectBucket(util.FullPath(requestURI))
|
|
||||||
bucketDefaultReplication, fsync = fs.filer.ReadBucketOption(collection)
|
|
||||||
}
|
|
||||||
if replication == "" {
|
|
||||||
replication = bucketDefaultReplication
|
|
||||||
}
|
|
||||||
|
|
||||||
rule := fs.filer.FilerConf.MatchStorageRule(requestURI)
|
rule := fs.filer.FilerConf.MatchStorageRule(requestURI)
|
||||||
|
|
||||||
|
@ -135,6 +123,13 @@ func (fs *FilerServer) detectStorageOption(requestURI, qCollection, qReplication
|
||||||
return nil, ErrReadOnly
|
return nil, ErrReadOnly
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// required by buckets folder
|
||||||
|
bucketDefaultCollection, bucketDefaultReplication, fsync := "", "", false
|
||||||
|
if strings.HasPrefix(requestURI, fs.filer.DirBucketsPath+"/") {
|
||||||
|
bucketDefaultCollection = fs.filer.DetectBucket(util.FullPath(requestURI))
|
||||||
|
bucketDefaultReplication, fsync = fs.filer.ReadBucketOption(bucketDefaultCollection)
|
||||||
|
}
|
||||||
|
|
||||||
if ttlSeconds == 0 {
|
if ttlSeconds == 0 {
|
||||||
ttl, err := needle.ReadTTL(rule.GetTtl())
|
ttl, err := needle.ReadTTL(rule.GetTtl())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -144,8 +139,8 @@ func (fs *FilerServer) detectStorageOption(requestURI, qCollection, qReplication
|
||||||
}
|
}
|
||||||
|
|
||||||
return &operation.StorageOption{
|
return &operation.StorageOption{
|
||||||
Replication: util.Nvl(replication, rule.Replication),
|
Replication: util.Nvl(qReplication, rule.Replication, bucketDefaultReplication, fs.option.DefaultReplication),
|
||||||
Collection: util.Nvl(collection, rule.Collection),
|
Collection: util.Nvl(qCollection, rule.Collection, bucketDefaultCollection, fs.option.Collection),
|
||||||
DataCenter: util.Nvl(dataCenter, fs.option.DataCenter),
|
DataCenter: util.Nvl(dataCenter, fs.option.DataCenter),
|
||||||
Rack: util.Nvl(rack, fs.option.Rack),
|
Rack: util.Nvl(rack, fs.option.Rack),
|
||||||
TtlSeconds: ttlSeconds,
|
TtlSeconds: ttlSeconds,
|
||||||
|
|
Loading…
Reference in a new issue