aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_volume_tier_move.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-08-13 03:09:28 -0700
committerChris Lu <chris.lu@gmail.com>2021-08-13 03:09:28 -0700
commit0f7d4556d839ffc9d0dcfbc965e3b970cb30c77d (patch)
treec91a04437e24626b00dc1f0e0de0efdd92f910ff /weed/shell/command_volume_tier_move.go
parent333cdce485ee5389306527cc8c1b40fdcf884137 (diff)
downloadseaweedfs-0f7d4556d839ffc9d0dcfbc965e3b970cb30c77d.tar.xz
seaweedfs-0f7d4556d839ffc9d0dcfbc965e3b970cb30c77d.zip
shell: volume.tier.move makes up changes if volume move failed
Diffstat (limited to 'weed/shell/command_volume_tier_move.go')
-rw-r--r--weed/shell/command_volume_tier_move.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/weed/shell/command_volume_tier_move.go b/weed/shell/command_volume_tier_move.go
index 9719b442d..c72958259 100644
--- a/weed/shell/command_volume_tier_move.go
+++ b/weed/shell/command_volume_tier_move.go
@@ -3,6 +3,7 @@ package shell
import (
"flag"
"fmt"
+ "github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
"github.com/chrislusf/seaweedfs/weed/storage/types"
"github.com/chrislusf/seaweedfs/weed/wdclient"
@@ -172,10 +173,16 @@ func (c *commandVolumeTierMove) doVolumeTierMove(commandEnv *CommandEnv, writer
func (c *commandVolumeTierMove) doMoveOneVolume(commandEnv *CommandEnv, writer io.Writer, vid needle.VolumeId, toDiskType types.DiskType, locations []wdclient.Location, sourceVolumeServer string, dst location) (err error) {
// mark all replicas as read only
- if err = markVolumeReadonly(commandEnv.option.GrpcDialOption, vid, locations); err != nil {
+ if err = markVolumeReplicasWritable(commandEnv.option.GrpcDialOption, vid, locations, false); err != nil {
return fmt.Errorf("mark volume %d as readonly on %s: %v", vid, locations[0].Url, err)
}
if err = LiveMoveVolume(commandEnv.option.GrpcDialOption, writer, vid, sourceVolumeServer, dst.dataNode.Id, 5*time.Second, toDiskType.ReadableString(), true); err != nil {
+
+ // mark all replicas as writable
+ if err = markVolumeReplicasWritable(commandEnv.option.GrpcDialOption, vid, locations, true); err != nil {
+ glog.Errorf("mark volume %d as writable on %s: %v", vid, locations[0].Url, err)
+ }
+
return fmt.Errorf("move volume %d %s => %s : %v", vid, locations[0].Url, dst.dataNode.Id, err)
}