diff options
| author | dsd <60881537+dsd2077@users.noreply.github.com> | 2024-12-20 23:36:13 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-20 07:36:13 -0800 |
| commit | 20cbc9e4ebf8a3968dbd2df9aebb7bd1f132e302 (patch) | |
| tree | 4c5a43686b0dd0021c19db54be077b4b8a996d87 | |
| parent | d7dfb11be92fc8912ecd4c9284851011141d888b (diff) | |
| download | seaweedfs-20cbc9e4ebf8a3968dbd2df9aebb7bd1f132e302.tar.xz seaweedfs-20cbc9e4ebf8a3968dbd2df9aebb7bd1f132e302.zip | |
skip error while executing volume.fix.replication (#6382)
| -rw-r--r-- | weed/shell/command_volume_fix_replication.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/weed/shell/command_volume_fix_replication.go b/weed/shell/command_volume_fix_replication.go index f664ccbb2..86593db27 100644 --- a/weed/shell/command_volume_fix_replication.go +++ b/weed/shell/command_volume_fix_replication.go @@ -9,12 +9,13 @@ import ( "strconv" "time" + "slices" + "github.com/seaweedfs/seaweedfs/weed/pb" "github.com/seaweedfs/seaweedfs/weed/storage/needle" "github.com/seaweedfs/seaweedfs/weed/storage/needle_map" "github.com/seaweedfs/seaweedfs/weed/storage/types" "google.golang.org/grpc" - "slices" "github.com/seaweedfs/seaweedfs/weed/operation" "github.com/seaweedfs/seaweedfs/weed/pb/master_pb" @@ -232,7 +233,7 @@ func (c *commandVolumeFixReplication) deleteOneVolume(commandEnv *CommandEnv, wr return fmt.Errorf("match pattern %s with collection %s: %v", *c.collectionPattern, replica.info.Collection, err) } if !matched { - break + continue } } @@ -254,19 +255,24 @@ func (c *commandVolumeFixReplication) deleteOneVolume(commandEnv *CommandEnv, wr } if doCheck { + var checkErr error for _, replicaB := range replicas { if replicaB.location.dataNode == replica.location.dataNode { continue } - if err := checkOneVolume(replica, replicaB, writer, commandEnv.option.GrpcDialOption); err != nil { - return fmt.Errorf("sync volume %d on %s and %s: %v\n", replica.info.Id, replica.location.dataNode.Id, replicaB.location.dataNode.Id, err) + if checkErr = checkOneVolume(replica, replicaB, writer, commandEnv.option.GrpcDialOption); checkErr != nil { + fmt.Fprintf(writer, "sync volume %d on %s and %s: %v\n", replica.info.Id, replica.location.dataNode.Id, replicaB.location.dataNode.Id, checkErr) + break } } + if checkErr != nil { + continue + } } if err := deleteVolume(commandEnv.option.GrpcDialOption, needle.VolumeId(replica.info.Id), pb.NewServerAddressFromDataNode(replica.location.dataNode), false); err != nil { - return fmt.Errorf("deleting volume %d from %s : %v", replica.info.Id, replica.location.dataNode.Id, err) + fmt.Fprintf(writer, "deleting volume %d from %s : %v", replica.info.Id, replica.location.dataNode.Id, err) } } |
