diff options
| author | Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> | 2024-11-20 21:35:24 +0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-20 08:35:24 -0800 |
| commit | 254ed8897e17b359cbdfb8e5da2922e35c4e0f2d (patch) | |
| tree | 20296add7582471b335e6d737bb414937974261a | |
| parent | 96f1a2e01a579184cf614a5f42194fdcc53c9b2d (diff) | |
| download | seaweedfs-254ed8897e17b359cbdfb8e5da2922e35c4e0f2d.tar.xz seaweedfs-254ed8897e17b359cbdfb8e5da2922e35c4e0f2d.zip | |
[shell] add noLock param for volume.move (#6261)
| -rw-r--r-- | weed/shell/command_volume_move.go | 14 | ||||
| -rw-r--r-- | weed/shell/commands.go | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/weed/shell/command_volume_move.go b/weed/shell/command_volume_move.go index cf9991695..2ddd3f625 100644 --- a/weed/shell/command_volume_move.go +++ b/weed/shell/command_volume_move.go @@ -14,6 +14,8 @@ import ( "github.com/seaweedfs/seaweedfs/weed/operation" "github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb" "github.com/seaweedfs/seaweedfs/weed/storage/needle" + "github.com/seaweedfs/seaweedfs/weed/util" + "google.golang.org/grpc" ) @@ -61,12 +63,18 @@ func (c *commandVolumeMove) Do(args []string, commandEnv *CommandEnv, writer io. targetNodeStr := volMoveCommand.String("target", "", "the target volume server <host>:<port>") diskTypeStr := volMoveCommand.String("disk", "", "[hdd|ssd|<tag>] hard drive or solid state drive or any tag") ioBytePerSecond := volMoveCommand.Int64("ioBytePerSecond", 0, "limit the speed of move") + noLock := volMoveCommand.Bool("noLock", false, "do not lock the admin shell at one's own risk") + if err = volMoveCommand.Parse(args); err != nil { return nil } - if err = commandEnv.confirmIsLocked(args); err != nil { - return + if *noLock { + commandEnv.noLock = true + } else { + if err = commandEnv.confirmIsLocked(args); err != nil { + return + } } sourceVolumeServer, targetVolumeServer := pb.ServerAddress(*sourceNodeStr), pb.ServerAddress(*targetNodeStr) @@ -169,7 +177,7 @@ func copyVolume(grpcDialOption grpc.DialOption, writer io.Writer, volumeId needl if resp.LastAppendAtNs != 0 { lastAppendAtNs = resp.LastAppendAtNs } else { - fmt.Fprintf(writer, "volume %d processed %d bytes\n", volumeId, resp.ProcessedBytes) + fmt.Fprintf(writer, "%s => %s volume %d processed %s\n", sourceVolumeServer, targetVolumeServer, volumeId, util.BytesToHumanReadable(uint64(resp.ProcessedBytes))) } } diff --git a/weed/shell/commands.go b/weed/shell/commands.go index dbbd86f0e..264dd4818 100644 --- a/weed/shell/commands.go +++ b/weed/shell/commands.go @@ -82,7 +82,7 @@ func (ce *CommandEnv) isLocked() bool { return true } if ce.noLock { - return false + return true } return ce.locker.IsLocked() } |
