mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-11-23 18:49:17 +08:00
[shell] add noLock param for volume.move (#6261)
This commit is contained in:
parent
96f1a2e01a
commit
254ed8897e
@ -14,6 +14,8 @@ import (
|
|||||||
"github.com/seaweedfs/seaweedfs/weed/operation"
|
"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"
|
"github.com/seaweedfs/seaweedfs/weed/storage/needle"
|
||||||
|
"github.com/seaweedfs/seaweedfs/weed/util"
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"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>")
|
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")
|
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")
|
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 {
|
if err = volMoveCommand.Parse(args); err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = commandEnv.confirmIsLocked(args); err != nil {
|
if *noLock {
|
||||||
return
|
commandEnv.noLock = true
|
||||||
|
} else {
|
||||||
|
if err = commandEnv.confirmIsLocked(args); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceVolumeServer, targetVolumeServer := pb.ServerAddress(*sourceNodeStr), pb.ServerAddress(*targetNodeStr)
|
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 {
|
if resp.LastAppendAtNs != 0 {
|
||||||
lastAppendAtNs = resp.LastAppendAtNs
|
lastAppendAtNs = resp.LastAppendAtNs
|
||||||
} else {
|
} 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)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ func (ce *CommandEnv) isLocked() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if ce.noLock {
|
if ce.noLock {
|
||||||
return false
|
return true
|
||||||
}
|
}
|
||||||
return ce.locker.IsLocked()
|
return ce.locker.IsLocked()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user