diff options
| author | dsd <60881537+dsd2077@users.noreply.github.com> | 2024-09-11 22:39:40 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-11 07:39:40 -0700 |
| commit | 3b840c20e3c6ef9f9ed9ac5159251d210b9dd484 (patch) | |
| tree | c2d84531eb8c71c9998fc1ce1bc121646cf6ac91 | |
| parent | c04edeed683595e780262a3ee461eb79b7b151a0 (diff) | |
| download | seaweedfs-3b840c20e3c6ef9f9ed9ac5159251d210b9dd484.tar.xz seaweedfs-3b840c20e3c6ef9f9ed9ac5159251d210b9dd484.zip | |
change math/rand => math/rand/v2 in volume_layout.go where is a perfo… (#6006)
| -rw-r--r-- | weed/topology/volume_layout.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/weed/topology/volume_layout.go b/weed/topology/volume_layout.go index 610502769..55827f314 100644 --- a/weed/topology/volume_layout.go +++ b/weed/topology/volume_layout.go @@ -2,12 +2,13 @@ package topology import ( "fmt" - "github.com/seaweedfs/seaweedfs/weed/pb/master_pb" - "math/rand" + "math/rand/v2" "sync" "sync/atomic" "time" + "github.com/seaweedfs/seaweedfs/weed/pb/master_pb" + "github.com/seaweedfs/seaweedfs/weed/storage/types" "github.com/seaweedfs/seaweedfs/weed/glog" @@ -304,7 +305,7 @@ func (vl *VolumeLayout) PickForWrite(count uint64, option *VolumeGrowOption) (vi return 0, 0, nil, true, fmt.Errorf("%s", noWritableVolumes) } if option.DataCenter == "" && option.Rack == "" && option.DataNode == "" { - vid := vl.writables[rand.Intn(lenWriters)] + vid := vl.writables[rand.IntN(lenWriters)] locationList = vl.vid2location[vid] if locationList == nil || len(locationList.list) == 0 { return 0, 0, nil, false, fmt.Errorf("Strangely vid %s is on no machine!", vid.String()) |
