aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_volume_fix_replication.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-09-14 00:07:27 -0700
committerchrislu <chris.lu@gmail.com>2022-09-14 00:07:27 -0700
commit956ce6416fae66646344782cc7f6f557708eb1f4 (patch)
tree816b56483f063eebf9be9c9fe41d7410aba661f3 /weed/shell/command_volume_fix_replication.go
parent3f4400dc03c3c1476f3edf89d3da31f57bcd4278 (diff)
parent58d18b68d8ca463cef2a817f69f62e7b2fbd61f0 (diff)
downloadseaweedfs-956ce6416fae66646344782cc7f6f557708eb1f4.tar.xz
seaweedfs-956ce6416fae66646344782cc7f6f557708eb1f4.zip
Merge branch 'master' into message_send
Diffstat (limited to 'weed/shell/command_volume_fix_replication.go')
-rw-r--r--weed/shell/command_volume_fix_replication.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/weed/shell/command_volume_fix_replication.go b/weed/shell/command_volume_fix_replication.go
index 5cc4ba645..c773f3904 100644
--- a/weed/shell/command_volume_fix_replication.go
+++ b/weed/shell/command_volume_fix_replication.go
@@ -57,6 +57,7 @@ func (c *commandVolumeFixReplication) Do(args []string, commandEnv *CommandEnv,
volFixReplicationCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError)
c.collectionPattern = volFixReplicationCommand.String("collectionPattern", "", "match with wildcard characters '*' and '?'")
skipChange := volFixReplicationCommand.Bool("n", false, "skip the changes")
+ noDelete := volFixReplicationCommand.Bool("noDelete", false, "Do not delete over-replicated volumes, only fix under-replication")
retryCount := volFixReplicationCommand.Int("retry", 0, "how many times to retry")
volumesPerStep := volFixReplicationCommand.Int("volumesPerStep", 0, "how many volumes to fix in one cycle")
@@ -69,6 +70,7 @@ func (c *commandVolumeFixReplication) Do(args []string, commandEnv *CommandEnv,
}
takeAction := !*skipChange
+ doDeletes := !*noDelete;
underReplicatedVolumeIdsCount := 1
for underReplicatedVolumeIdsCount > 0 {
@@ -108,13 +110,13 @@ func (c *commandVolumeFixReplication) Do(args []string, commandEnv *CommandEnv,
return fmt.Errorf("lock is lost")
}
- if len(overReplicatedVolumeIds) > 0 {
+ if len(overReplicatedVolumeIds) > 0 && doDeletes {
if err := c.deleteOneVolume(commandEnv, writer, takeAction, overReplicatedVolumeIds, volumeReplicas, allLocations, pickOneReplicaToDelete); err != nil {
return err
}
}
- if len(misplacedVolumeIds) > 0 {
+ if len(misplacedVolumeIds) > 0 && doDeletes {
if err := c.deleteOneVolume(commandEnv, writer, takeAction, misplacedVolumeIds, volumeReplicas, allLocations, pickOneMisplacedVolume); err != nil {
return err
}