From 57e441d67be69311b2428d88dd41b5791ee51f99 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 29 Oct 2019 23:18:01 -0700 Subject: [PATCH] fix compaction logic --- weed/storage/volume_vacuum.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/weed/storage/volume_vacuum.go b/weed/storage/volume_vacuum.go index 73314f022..0e5130572 100644 --- a/weed/storage/volume_vacuum.go +++ b/weed/storage/volume_vacuum.go @@ -23,7 +23,7 @@ func (v *Volume) garbageLevel() float64 { func (v *Volume) Compact(preallocate int64, compactionBytePerSecond int64) error { - if v.MemoryMapMaxSizeMb > 0 { //it makes no sense to compact in memory + if v.MemoryMapMaxSizeMb == 0 { //it makes no sense to compact in memory glog.V(3).Infof("Compacting volume %d ...", v.Id) //no need to lock for copy on write //v.accessLock.Lock() @@ -46,7 +46,7 @@ func (v *Volume) Compact(preallocate int64, compactionBytePerSecond int64) error func (v *Volume) Compact2() error { - if v.MemoryMapMaxSizeMb > 0 { //it makes no sense to compact in memory + if v.MemoryMapMaxSizeMb == 0 { //it makes no sense to compact in memory glog.V(3).Infof("Compact2 volume %d ...", v.Id) v.isCompacting = true @@ -63,7 +63,7 @@ func (v *Volume) Compact2() error { } func (v *Volume) CommitCompact() error { - if v.MemoryMapMaxSizeMb > 0 { //it makes no sense to compact in memory + if v.MemoryMapMaxSizeMb == 0 { //it makes no sense to compact in memory glog.V(0).Infof("Committing volume %d vacuuming...", v.Id) v.isCompacting = true