aboutsummaryrefslogtreecommitdiff
path: root/weed/topology/topology.go
diff options
context:
space:
mode:
authorKonstantin Lebedev <9497591+kmlebedev@users.noreply.github.com>2024-07-31 01:21:35 +0500
committerGitHub <noreply@github.com>2024-07-30 13:21:35 -0700
commitb2ffcdaab2e662d85913eee7fa11eddb57d3052e (patch)
tree372561ac009a61554c070da31dae7de096a00fcc /weed/topology/topology.go
parent69bcdf470bf62e9ba71da283d60a203bdbcb3fcb (diff)
downloadseaweedfs-b2ffcdaab2e662d85913eee7fa11eddb57d3052e.tar.xz
seaweedfs-b2ffcdaab2e662d85913eee7fa11eddb57d3052e.zip
[master] do sync grow request only if absolutely necessary (#5821)
* do sync grow request only if absolutely necessary https://github.com/seaweedfs/seaweedfs/pull/5819 * remove check VolumeGrowStrategy Threshold on PickForWrite * fix fmt.Errorf
Diffstat (limited to 'weed/topology/topology.go')
-rw-r--r--weed/topology/topology.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/weed/topology/topology.go b/weed/topology/topology.go
index 44566e361..6a149bd56 100644
--- a/weed/topology/topology.go
+++ b/weed/topology/topology.go
@@ -251,8 +251,8 @@ func (t *Topology) PickForWrite(requestedCount uint64, option *VolumeGrowOption,
if err != nil {
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.Length() == 0 {
- return "", 0, nil, shouldGrow, fmt.Errorf("no writable volumes available for collection:%s replication:%s ttl:%s", option.Collection, option.ReplicaPlacement.String(), option.Ttl.String())
+ 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())
}
nextFileId := t.Sequence.NextFileId(requestedCount)
fileId = needle.NewFileId(vid, nextFileId, rand.Uint32()).String()