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
fix: avoid deleting more than one replica (#4873)
Konstantin Lebedevdf4ded758e24
diff --git a/weed/shell/command_volume_fix_replication.go b/weed/shell/command_volume_fix_replication.goindex 56f5f55326..cee45ee1de 100644--- a/weed/shell/command_volume_fix_replication.go+++ b/weed/shell/command_volume_fix_replication.go@@ -95,14 +95,15 @@ func (c *commandVolumeFixReplication) Do(args []string, commandEnv *CommandEnv,for vid, replicas := range volumeReplicas {replica := replicas[0]replicaPlacement, _ := super_block.NewReplicaPlacementFromByte(byte(replica.info.ReplicaPlacement))- if replicaPlacement.GetCopyCount() > len(replicas) {+ switch {+ case replicaPlacement.GetCopyCount() > len(replicas):underReplicatedVolumeIds = append(underReplicatedVolumeIds, vid)- } else if replicaPlacement.GetCopyCount() < len(replicas) {+ case isMisplaced(replicas, replicaPlacement):+ misplacedVolumeIds = append(misplacedVolumeIds, vid)+ fmt.Fprintf(writer, "volume %d replication %s is not well placed %+v\n", replica.info.Id, replicaPlacement, replica)+ case replicaPlacement.GetCopyCount() < len(replicas):overReplicatedVolumeIds = append(overReplicatedVolumeIds, vid)fmt.Fprintf(writer, "volume %d replication %s, but over replicated %+d\n", replica.info.Id, replicaPlacement, len(replicas))- } else if isMisplaced(replicas, replicaPlacement) {- misplacedVolumeIds = append(misplacedVolumeIds, vid)- fmt.Fprintf(writer, "volume %d replication %s is not well placed %+v\n", replica.info.Id, replicaPlacement, replicas)}}