|
@ -4,7 +4,7 @@ import ( |
|
|
"encoding/json" |
|
|
"encoding/json" |
|
|
"fmt" |
|
|
"fmt" |
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb" |
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb" |
|
|
"math/rand" |
|
|
|
|
|
|
|
|
"math/rand/v2" |
|
|
"sync" |
|
|
"sync" |
|
|
"time" |
|
|
"time" |
|
|
|
|
|
|
|
@ -222,7 +222,7 @@ func (vg *VolumeGrowth) findEmptySlotsForOneVolume(topo *Topology, option *Volum |
|
|
servers = append(servers, server.(*DataNode)) |
|
|
servers = append(servers, server.(*DataNode)) |
|
|
} |
|
|
} |
|
|
for _, rack := range otherRacks { |
|
|
for _, rack := range otherRacks { |
|
|
r := rand.Int63n(rack.AvailableSpaceFor(option)) |
|
|
|
|
|
|
|
|
r := rand.Int64N(rack.AvailableSpaceFor(option)) |
|
|
if server, e := rack.ReserveOneVolume(r, option); e == nil { |
|
|
if server, e := rack.ReserveOneVolume(r, option); e == nil { |
|
|
servers = append(servers, server) |
|
|
servers = append(servers, server) |
|
|
} else { |
|
|
} else { |
|
@ -230,7 +230,7 @@ func (vg *VolumeGrowth) findEmptySlotsForOneVolume(topo *Topology, option *Volum |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
for _, datacenter := range otherDataCenters { |
|
|
for _, datacenter := range otherDataCenters { |
|
|
r := rand.Int63n(datacenter.AvailableSpaceFor(option)) |
|
|
|
|
|
|
|
|
r := rand.Int64N(datacenter.AvailableSpaceFor(option)) |
|
|
if server, e := datacenter.ReserveOneVolume(r, option); e == nil { |
|
|
if server, e := datacenter.ReserveOneVolume(r, option); e == nil { |
|
|
servers = append(servers, server) |
|
|
servers = append(servers, server) |
|
|
} else { |
|
|
} else { |
|
|