support enable/disable vacuum (#4087)

* stop vacuum

* suspend/resume vacuum

* remove unused code

* rename

* rename param
This commit is contained in:
Guo Lei
2022-12-28 17:36:44 +08:00
committed by GitHub
parent 84492976c9
commit d8cfa1552b
17 changed files with 656 additions and 255 deletions

View File

@@ -35,6 +35,7 @@ type Topology struct {
volumeSizeLimit uint64
replicationAsMin bool
isDisableVacuum bool
Sequence sequence.Sequencer
@@ -338,3 +339,13 @@ func (t *Topology) DataNodeRegistration(dcName, rackName string, dn *DataNode) {
rack.LinkChildNode(dn)
glog.Infof("[%s] reLink To topo ", dn.Id())
}
func (t *Topology) DisableVacuum() {
glog.V(0).Infof("DisableVacuum")
t.isDisableVacuum = true
}
func (t *Topology) EnableVacuum() {
glog.V(0).Infof("EnableVacuum")
t.isDisableVacuum = false
}

View File

@@ -1,12 +1,13 @@
package topology
import (
"math/rand"
"time"
"github.com/seaweedfs/seaweedfs/weed/stats"
"github.com/seaweedfs/seaweedfs/weed/storage/erasure_coding"
"github.com/seaweedfs/seaweedfs/weed/storage/types"
"google.golang.org/grpc"
"math/rand"
"time"
"github.com/seaweedfs/seaweedfs/weed/glog"
"github.com/seaweedfs/seaweedfs/weed/storage"
@@ -25,7 +26,9 @@ func (t *Topology) StartRefreshWritableVolumes(grpcDialOption grpc.DialOption, g
go func(garbageThreshold float64) {
for {
if t.IsLeader() {
t.Vacuum(grpcDialOption, garbageThreshold, 0, "", preallocate)
if !t.isDisableVacuum {
t.Vacuum(grpcDialOption, garbageThreshold, 0, "", preallocate)
}
} else {
stats.MasterReplicaPlacementMismatch.Reset()
}