aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_volume_check_disk.go
diff options
context:
space:
mode:
authorKonstantin Lebedev <lebedev_k@tochka.com>2021-03-24 22:51:22 +0500
committerKonstantin Lebedev <lebedev_k@tochka.com>2021-03-24 22:51:22 +0500
commit020a5d40c32d458492a5ef4a960e58f24e12e991 (patch)
treee24181e14aaf17675d11eab2f20cbd2ff4345e61 /weed/shell/command_volume_check_disk.go
parentdf6cf0a2fabe557a85427a865aa8256783555fae (diff)
downloadseaweedfs-020a5d40c32d458492a5ef4a960e58f24e12e991.tar.xz
seaweedfs-020a5d40c32d458492a5ef4a960e58f24e12e991.zip
avoid counter is null
Diffstat (limited to 'weed/shell/command_volume_check_disk.go')
-rw-r--r--weed/shell/command_volume_check_disk.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/weed/shell/command_volume_check_disk.go b/weed/shell/command_volume_check_disk.go
index 05caa72e9..5a0d46869 100644
--- a/weed/shell/command_volume_check_disk.go
+++ b/weed/shell/command_volume_check_disk.go
@@ -130,6 +130,11 @@ func (c *commandVolumeCheckDisk) doVolumeCheckDisk(subtrahend, minuend *needle_m
})
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))
+
+ if counter == 0 || len(missingNeedles) == 0 {
+ return nil
+ }
+
missingNeedlesFraction := float64(len(missingNeedles)) / float64(counter)
if missingNeedlesFraction > nonRepairThreshold {
return fmt.Errorf(