diff options
| author | Chris Lu <chris.lu@gmail.com> | 2018-06-25 01:20:15 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2018-06-25 01:20:15 -0700 |
| commit | 9bcaa655742649ca54c2663a914a2479a6a0db05 (patch) | |
| tree | d4b76875dcfb85817386ffc881c30888bf571029 | |
| parent | 0d83c1b91eba8edb64b247984a2a02d3e774c9ce (diff) | |
| download | seaweedfs-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.go | 3 |
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()) } |
