aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_volume_tier_move.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-09-17 10:18:14 -0700
committerchrislu <chris.lu@gmail.com>2022-09-17 10:18:14 -0700
commit1c79301f89762ed25a431bcb5f4e02858dc02218 (patch)
treed0d6c5c44f7524ec38d7002e393d194769278649 /weed/shell/command_volume_tier_move.go
parent956ce6416fae66646344782cc7f6f557708eb1f4 (diff)
parent3fc261d27c90fc06c1d555dd998d7535b844a746 (diff)
downloadseaweedfs-1c79301f89762ed25a431bcb5f4e02858dc02218.tar.xz
seaweedfs-1c79301f89762ed25a431bcb5f4e02858dc02218.zip
Merge branch 'master' into message_send
Diffstat (limited to 'weed/shell/command_volume_tier_move.go')
-rw-r--r--weed/shell/command_volume_tier_move.go44
1 files changed, 22 insertions, 22 deletions
diff --git a/weed/shell/command_volume_tier_move.go b/weed/shell/command_volume_tier_move.go
index ae9e83c2a..a59119a40 100644
--- a/weed/shell/command_volume_tier_move.go
+++ b/weed/shell/command_volume_tier_move.go
@@ -1,6 +1,8 @@
package shell
import (
+ "context"
+ "errors"
"flag"
"fmt"
"github.com/seaweedfs/seaweedfs/weed/glog"
@@ -12,11 +14,9 @@ import (
"path/filepath"
"sync"
"time"
- "context"
- "errors"
"github.com/seaweedfs/seaweedfs/weed/operation"
- "github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
+ "github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb"
"github.com/seaweedfs/seaweedfs/weed/storage/needle"
)
@@ -63,7 +63,7 @@ func (c *commandVolumeTierMove) Do(args []string, commandEnv *CommandEnv, writer
parallelLimit := tierCommand.Int("parallelLimit", 0, "limit the number of parallel copying jobs")
applyChange := tierCommand.Bool("force", false, "actually apply the changes")
ioBytePerSecond := tierCommand.Int64("ioBytePerSecond", 0, "limit the speed of move")
- replicationString := tierCommand.String("toReplication", "", "the new target replication setting");
+ replicationString := tierCommand.String("toReplication", "", "the new target replication setting")
if err = tierCommand.Parse(args); err != nil {
return nil
@@ -226,7 +226,7 @@ func (c *commandVolumeTierMove) doVolumeTierMove(commandEnv *CommandEnv, writer
return nil
}
-func (c *commandVolumeTierMove) doMoveOneVolume(commandEnv *CommandEnv, writer io.Writer, vid needle.VolumeId, toDiskType types.DiskType, locations []wdclient.Location, sourceVolumeServer pb.ServerAddress, dst location, ioBytePerSecond int64, replicationString *string ) (err error) {
+func (c *commandVolumeTierMove) doMoveOneVolume(commandEnv *CommandEnv, writer io.Writer, vid needle.VolumeId, toDiskType types.DiskType, locations []wdclient.Location, sourceVolumeServer pb.ServerAddress, dst location, ioBytePerSecond int64, replicationString *string) (err error) {
if !commandEnv.isLocked() {
return fmt.Errorf("lock is lost")
@@ -247,25 +247,25 @@ func (c *commandVolumeTierMove) doMoveOneVolume(commandEnv *CommandEnv, writer i
return fmt.Errorf("move volume %d %s => %s : %v", vid, locations[0].Url, dst.dataNode.Id, err)
}
- // If move is successful and replication is not empty, alter moved volume's replication setting
- if *replicationString != "" {
- err = operation.WithVolumeServerClient(false, newAddress, commandEnv.option.GrpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {
- resp, configureErr := volumeServerClient.VolumeConfigure(context.Background(), &volume_server_pb.VolumeConfigureRequest{
- VolumeId: uint32(vid),
- Replication: *replicationString,
- })
- if configureErr != nil {
- return configureErr
- }
- if resp.Error != "" {
- return errors.New(resp.Error)
- }
- return nil
- })
+ // If move is successful and replication is not empty, alter moved volume's replication setting
+ if *replicationString != "" {
+ err = operation.WithVolumeServerClient(false, newAddress, commandEnv.option.GrpcDialOption, func(volumeServerClient volume_server_pb.VolumeServerClient) error {
+ resp, configureErr := volumeServerClient.VolumeConfigure(context.Background(), &volume_server_pb.VolumeConfigureRequest{
+ VolumeId: uint32(vid),
+ Replication: *replicationString,
+ })
+ if configureErr != nil {
+ return configureErr
+ }
+ if resp.Error != "" {
+ return errors.New(resp.Error)
+ }
+ return nil
+ })
if err != nil {
- glog.Errorf("update volume %d replication on %s: %v", vid, locations[0].Url, err)
+ glog.Errorf("update volume %d replication on %s: %v", vid, locations[0].Url, err)
}
- }
+ }
// remove the remaining replicas
for _, loc := range locations {