aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-09-10 11:22:18 -0700
committerchrislu <chris.lu@gmail.com>2022-09-10 11:22:18 -0700
commitebef579ebb4b0b3b7fcf2f53f13002628638c42d (patch)
tree7d5581c0edd90b9a98aa0f131cefeb7abb1277d4
parent576c113c594ed82331f5ca7c03dc17aeef96c8c8 (diff)
parent4e3e2b1b821572f5417df178dd9fcf9f5d51edab (diff)
downloadseaweedfs-ebef579ebb4b0b3b7fcf2f53f13002628638c42d.tar.xz
seaweedfs-ebef579ebb4b0b3b7fcf2f53f13002628638c42d.zip
Merge branch 'master' of https://github.com/seaweedfs/seaweedfs
-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
}