mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-08 00:24:23 +08:00
[master] avoid timeout when assigning for main request with filter by DC or rack (#6291)
* avoid timeout when assigning for main request with filter by DC or rack https://github.com/seaweedfs/seaweedfs/issues/6290 * use constant NoWritableVolumes
This commit is contained in:

committed by
GitHub

parent
fec88e64eb
commit
e2e97db917
@@ -254,7 +254,7 @@ func (t *Topology) PickForWrite(requestedCount uint64, option *VolumeGrowOption,
|
||||
return "", 0, nil, shouldGrow, fmt.Errorf("failed to find writable volumes for collection:%s replication:%s ttl:%s error: %v", option.Collection, option.ReplicaPlacement.String(), option.Ttl.String(), err)
|
||||
}
|
||||
if volumeLocationList == nil || volumeLocationList.Length() == 0 {
|
||||
return "", 0, nil, shouldGrow, fmt.Errorf("%s available for collection:%s replication:%s ttl:%s", noWritableVolumes, option.Collection, option.ReplicaPlacement.String(), option.Ttl.String())
|
||||
return "", 0, nil, shouldGrow, fmt.Errorf("%s available for collection:%s replication:%s ttl:%s", NoWritableVolumes, option.Collection, option.ReplicaPlacement.String(), option.Ttl.String())
|
||||
}
|
||||
nextFileId := t.Sequence.NextFileId(requestedCount)
|
||||
fileId = needle.NewFileId(vid, nextFileId, rand.Uint32()).String()
|
||||
|
@@ -31,7 +31,7 @@ const (
|
||||
readOnlyState volumeState = "ReadOnly"
|
||||
oversizedState = "Oversized"
|
||||
crowdedState = "Crowded"
|
||||
noWritableVolumes = "No writable volumes"
|
||||
NoWritableVolumes = "No writable volumes"
|
||||
)
|
||||
|
||||
type stateIndicator func(copyState) bool
|
||||
@@ -302,7 +302,7 @@ func (vl *VolumeLayout) PickForWrite(count uint64, option *VolumeGrowOption) (vi
|
||||
|
||||
lenWriters := len(vl.writables)
|
||||
if lenWriters <= 0 {
|
||||
return 0, 0, nil, true, fmt.Errorf("%s", noWritableVolumes)
|
||||
return 0, 0, nil, true, fmt.Errorf("%s", NoWritableVolumes)
|
||||
}
|
||||
if option.DataCenter == "" && option.Rack == "" && option.DataNode == "" {
|
||||
vid := vl.writables[rand.IntN(lenWriters)]
|
||||
@@ -337,7 +337,7 @@ func (vl *VolumeLayout) PickForWrite(count uint64, option *VolumeGrowOption) (vi
|
||||
return
|
||||
}
|
||||
}
|
||||
return vid, count, locationList, true, fmt.Errorf("%s in DataCenter:%v Rack:%v DataNode:%v", noWritableVolumes, option.DataCenter, option.Rack, option.DataNode)
|
||||
return vid, count, locationList, true, fmt.Errorf("%s in DataCenter:%v Rack:%v DataNode:%v", NoWritableVolumes, option.DataCenter, option.Rack, option.DataNode)
|
||||
}
|
||||
|
||||
func (vl *VolumeLayout) HasGrowRequest() bool {
|
||||
|
Reference in New Issue
Block a user