From 8eb14967ef45732d5efbdf3b5cab97e3b2f65527 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 22 Mar 2021 21:01:43 -0700 Subject: [PATCH] shell: volume.check.disk adds optional slow mode fix https://github.com/chrislusf/seaweedfs/issues/1930 --- weed/shell/command_volume_check_disk.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/weed/shell/command_volume_check_disk.go b/weed/shell/command_volume_check_disk.go index 62eb55907..64b510383 100644 --- a/weed/shell/command_volume_check_disk.go +++ b/weed/shell/command_volume_check_disk.go @@ -46,6 +46,7 @@ func (c *commandVolumeCheckDisk) Do(args []string, commandEnv *CommandEnv, write } fsckCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError) + slowMode := fsckCommand.Bool("slow", false, "slow mode checks all replicas even file counts are the same") verbose := fsckCommand.Bool("v", false, "verbose mode") applyChanges := fsckCommand.Bool("force", false, "apply the fix") if err = fsckCommand.Parse(args); err != nil { @@ -75,9 +76,11 @@ func (c *commandVolumeCheckDisk) Do(args []string, commandEnv *CommandEnv, write }) for len(replicas) >= 2 { a, b := replicas[0], replicas[1] - if fileCount(a) == fileCount(b) { - replicas = replicas[1:] - continue + if !*slowMode { + if fileCount(a) == fileCount(b) { + replicas = replicas[1:] + continue + } } if a.info.ReadOnly || b.info.ReadOnly { fmt.Fprintf(writer, "skipping readonly volume %d on %s and %s\n", a.info.Id, a.location.dataNode.Id, b.location.dataNode.Id) @@ -125,7 +128,7 @@ func (c *commandVolumeCheckDisk) doVolumeCheckDisk(subtrahend, minuend *needle_m return nil }) - fmt.Fprintf(writer, "%s has %d entries, %s missed %d entries\n", source.location.dataNode.Id, counter, target.location.dataNode.Id, len(missingNeedles)) + fmt.Fprintf(writer, "volume %d %s has %d entries, %s missed %d entries\n", source.info.Id, source.location.dataNode.Id, counter, target.location.dataNode.Id, len(missingNeedles)) for _, needleValue := range missingNeedles {