SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
Add option in volume.fix.replication to only fix under-replication and not delete volumes (#3640)
Brian4e3e2b1b8215
diff --git a/weed/shell/command_volume_fix_replication.go b/weed/shell/command_volume_fix_replication.goindex 5cc4ba6451..c773f39049 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 := 1for 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}