From 9bcaa655742649ca54c2663a914a2479a6a0db05 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 25 Jun 2018 01:20:15 -0700 Subject: [PATCH] avoid divided by 0 fix https://github.com/chrislusf/seaweedfs/issues/650 --- weed/storage/volume_vacuum.go | 3 +++ 1 file changed, 3 insertions(+) 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()) }