Thomas Anderson
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
6 additions and
5 deletions
-
weed/topology/node.go
|
|
@ -2,15 +2,16 @@ package topology |
|
|
|
|
|
|
|
import ( |
|
|
|
"errors" |
|
|
|
"math/rand" |
|
|
|
"strings" |
|
|
|
"sync" |
|
|
|
"sync/atomic" |
|
|
|
|
|
|
|
"github.com/seaweedfs/seaweedfs/weed/glog" |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/stats" |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/storage/erasure_coding" |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/storage/needle" |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/storage/types" |
|
|
|
"math/rand" |
|
|
|
"strings" |
|
|
|
"sync" |
|
|
|
"sync/atomic" |
|
|
|
) |
|
|
|
|
|
|
|
type NodeId string |
|
|
@ -73,7 +74,7 @@ func (n *NodeImpl) PickNodesByWeight(numberOfNodes int, option *VolumeGrowOption |
|
|
|
n.RUnlock() |
|
|
|
if len(candidates) < numberOfNodes { |
|
|
|
glog.V(0).Infoln(n.Id(), "failed to pick", numberOfNodes, "from ", len(candidates), "node candidates") |
|
|
|
return nil, nil, errors.New("No enough data node found!") |
|
|
|
return nil, nil, errors.New("Not enough data nodes found!") |
|
|
|
} |
|
|
|
|
|
|
|
//pick nodes randomly by weights, the node picked earlier has higher final weights
|
|
|
|