diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-03-22 21:01:43 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-03-22 21:01:43 -0700 |
| commit | 8eb14967ef45732d5efbdf3b5cab97e3b2f65527 (patch) | |
| tree | 579c07dd7472ddf7bd78e48869de7620bcde5107 | |
| parent | 288369cfc78b2e8d9d2f64a6769c9ce3f5e8ecc9 (diff) | |
| download | seaweedfs-8eb14967ef45732d5efbdf3b5cab97e3b2f65527.tar.xz seaweedfs-8eb14967ef45732d5efbdf3b5cab97e3b2f65527.zip | |
shell: volume.check.disk adds optional slow mode
fix https://github.com/chrislusf/seaweedfs/issues/1930
| -rw-r--r-- | weed/shell/command_volume_check_disk.go | 11 |
1 files 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 { |
