mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
alt request for dc preferred requests
This commit is contained in:
parent
8a12fd9ec4
commit
007c4a1965
|
@ -173,7 +173,7 @@ func (fs *FilerServer) AssignVolume(ctx context.Context, req *filer_pb.AssignVol
|
|||
ttlStr = strconv.Itoa(int(req.TtlSec))
|
||||
}
|
||||
|
||||
var backupRequest *operation.VolumeAssignRequest
|
||||
var altRequest *operation.VolumeAssignRequest
|
||||
|
||||
assignRequest := &operation.VolumeAssignRequest{
|
||||
Count: uint64(req.Count),
|
||||
|
@ -183,7 +183,7 @@ func (fs *FilerServer) AssignVolume(ctx context.Context, req *filer_pb.AssignVol
|
|||
DataCenter: fs.option.DataCenter,
|
||||
}
|
||||
if fs.option.DataCenter != "" {
|
||||
backupRequest = &operation.VolumeAssignRequest{
|
||||
altRequest = &operation.VolumeAssignRequest{
|
||||
Count: uint64(req.Count),
|
||||
Replication: req.Replication,
|
||||
Collection: req.Collection,
|
||||
|
@ -191,7 +191,7 @@ func (fs *FilerServer) AssignVolume(ctx context.Context, req *filer_pb.AssignVol
|
|||
DataCenter: "",
|
||||
}
|
||||
}
|
||||
assignResult, err := operation.Assign(fs.filer.GetMaster(), assignRequest, backupRequest)
|
||||
assignResult, err := operation.Assign(fs.filer.GetMaster(), assignRequest, altRequest)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("assign volume: %v", err)
|
||||
}
|
||||
|
|
|
@ -47,8 +47,19 @@ func (fs *FilerServer) assignNewFileInfo(w http.ResponseWriter, r *http.Request,
|
|||
Replication: replication,
|
||||
Collection: collection,
|
||||
Ttl: r.URL.Query().Get("ttl"),
|
||||
DataCenter: fs.option.DataCenter,
|
||||
}
|
||||
assignResult, ae := operation.Assign(fs.filer.GetMaster(), ar)
|
||||
var altRequest *operation.VolumeAssignRequest
|
||||
if fs.option.DataCenter != "" {
|
||||
altRequest = &operation.VolumeAssignRequest{
|
||||
Count: 1,
|
||||
Replication: replication,
|
||||
Collection: collection,
|
||||
Ttl: r.URL.Query().Get("ttl"),
|
||||
DataCenter: "",
|
||||
}
|
||||
}
|
||||
assignResult, ae := operation.Assign(fs.filer.GetMaster(), ar, altRequest)
|
||||
if ae != nil {
|
||||
glog.V(0).Infoln("failing to assign a file id", ae.Error())
|
||||
writeJsonError(w, r, http.StatusInternalServerError, ae)
|
||||
|
|
Loading…
Reference in a new issue