aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_ec_encode.go
diff options
context:
space:
mode:
authorhilimd <68371223+hilimd@users.noreply.github.com>2021-11-11 16:00:21 +0800
committerGitHub <noreply@github.com>2021-11-11 16:00:21 +0800
commit34240606f78395345ca7f6d7fe66a223c9bdf072 (patch)
tree914f76c6587989a39fe1c0f421782126248fbe8e /weed/shell/command_ec_encode.go
parentb5389c3b23502da7315dd258715e146be7cc0fc9 (diff)
parent835e2d2ddf959dc8dd234021ac3cde72bd9e9246 (diff)
downloadseaweedfs-34240606f78395345ca7f6d7fe66a223c9bdf072.tar.xz
seaweedfs-34240606f78395345ca7f6d7fe66a223c9bdf072.zip
Merge pull request #87 from chrislusf/master
sync
Diffstat (limited to 'weed/shell/command_ec_encode.go')
-rw-r--r--weed/shell/command_ec_encode.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/weed/shell/command_ec_encode.go b/weed/shell/command_ec_encode.go
index 33eef9ca7..3606f42e3 100644
--- a/weed/shell/command_ec_encode.go
+++ b/weed/shell/command_ec_encode.go
@@ -6,6 +6,7 @@ import (
"fmt"
"github.com/chrislusf/seaweedfs/weed/pb"
"io"
+ "math/rand"
"sync"
"time"
@@ -33,7 +34,7 @@ func (c *commandEcEncode) Name() string {
func (c *commandEcEncode) Help() string {
return `apply erasure coding to a volume
- ec.encode [-collection=""] [-fullPercent=95] [-quietFor=1h]
+ ec.encode [-collection=""] [-fullPercent=95 -quietFor=1h]
ec.encode [-collection=""] [-volumeId=<volume_id>]
This command will:
@@ -248,7 +249,7 @@ func parallelCopyEcShardsFromSource(grpcDialOption grpc.DialOption, targetServer
func balancedEcDistribution(servers []*EcNode) (allocated [][]uint32) {
allocated = make([][]uint32, len(servers))
allocatedShardIdIndex := uint32(0)
- serverIndex := 0
+ serverIndex := rand.Intn(len(servers))
for allocatedShardIdIndex < erasure_coding.TotalShardsCount {
if servers[serverIndex].freeEcSlot > 0 {
allocated[serverIndex] = append(allocated[serverIndex], allocatedShardIdIndex)