diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-07-16 12:08:21 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-07-16 12:08:21 -0700 |
| commit | 2f209675ab9dd49a9c15a656a1358a1b388f0a4b (patch) | |
| tree | 1224f489027f410bcf371982a932f73a74be4c0c | |
| parent | fb7a1be1c4141b0e896d95a031a408ea7a1079e6 (diff) | |
| download | seaweedfs-2f209675ab9dd49a9c15a656a1358a1b388f0a4b.tar.xz seaweedfs-2f209675ab9dd49a9c15a656a1358a1b388f0a4b.zip | |
Added `-retry` option for `volumeServer.evacuate`
related to https://github.com/chrislusf/seaweedfs/issues/2191
| -rw-r--r-- | weed/shell/command_volume_server_evacuate.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/weed/shell/command_volume_server_evacuate.go b/weed/shell/command_volume_server_evacuate.go index f21d0334c..fb9bf79c6 100644 --- a/weed/shell/command_volume_server_evacuate.go +++ b/weed/shell/command_volume_server_evacuate.go @@ -52,6 +52,7 @@ func (c *commandVolumeServerEvacuate) Do(args []string, commandEnv *CommandEnv, volumeServer := vsEvacuateCommand.String("node", "", "<host>:<port> of the volume server") skipNonMoveable := vsEvacuateCommand.Bool("skipNonMoveable", false, "skip volumes that can not be moved") applyChange := vsEvacuateCommand.Bool("force", false, "actually apply the changes") + retryCount := vsEvacuateCommand.Int("retry", 0, "how many times to retry") if err = vsEvacuateCommand.Parse(args); err != nil { return nil } @@ -60,7 +61,13 @@ func (c *commandVolumeServerEvacuate) Do(args []string, commandEnv *CommandEnv, return fmt.Errorf("need to specify volume server by -node=<host>:<port>") } - return volumeServerEvacuate(commandEnv, *volumeServer, *skipNonMoveable, *applyChange, writer) + for i:=0;i<*retryCount+1;i++{ + if err = volumeServerEvacuate(commandEnv, *volumeServer, *skipNonMoveable, *applyChange, writer); err == nil { + return nil + } + } + + return } |
