aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2018-06-25 01:20:15 -0700
committerChris Lu <chris.lu@gmail.com>2018-06-25 01:20:15 -0700
commit9bcaa655742649ca54c2663a914a2479a6a0db05 (patch)
treed4b76875dcfb85817386ffc881c30888bf571029
parent0d83c1b91eba8edb64b247984a2a02d3e774c9ce (diff)
downloadseaweedfs-9bcaa655742649ca54c2663a914a2479a6a0db05.tar.xz
seaweedfs-9bcaa655742649ca54c2663a914a2479a6a0db05.zip
avoid divided by 0
fix https://github.com/chrislusf/seaweedfs/issues/650
-rw-r--r--weed/storage/volume_vacuum.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/weed/storage/volume_vacuum.go b/weed/storage/volume_vacuum.go
index 230fca104..c0bdcdf96 100644
--- a/weed/storage/volume_vacuum.go
+++ b/weed/storage/volume_vacuum.go
@@ -10,6 +10,9 @@ import (
)
func (v *Volume) garbageLevel() float64 {
+ if v.ContentSize() == 0 {
+ return 0
+ }
return float64(v.nm.DeletedSize()) / float64(v.ContentSize())
}