aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Lebedev <9497591+kmlebedev@users.noreply.github.com>2022-08-12 23:11:09 +0300
committerGitHub <noreply@github.com>2022-08-12 13:11:09 -0700
commit6199d9b9234c3aeef108e41023d552f073bd571d (patch)
tree34ff71bd6b1153c559d91d3a4fceb7adb1b553cb
parentd8c54b527e55db48b9a28bb3f9216f0993b0e295 (diff)
downloadseaweedfs-6199d9b9234c3aeef108e41023d552f073bd571d.tar.xz
seaweedfs-6199d9b9234c3aeef108e41023d552f073bd571d.zip
rand start garbageThreshold and reset metric ReplicaPlacementMismatch (#3396)
* rand start garbageThreshold reset metrics MasterReplicaPlacementMismatch * vacuum through sleep
-rw-r--r--weed/topology/topology_event_handling.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/weed/topology/topology_event_handling.go b/weed/topology/topology_event_handling.go
index 96051d25f..d0d175a39 100644
--- a/weed/topology/topology_event_handling.go
+++ b/weed/topology/topology_event_handling.go
@@ -1,6 +1,7 @@
package topology
import (
+ "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"
@@ -22,11 +23,13 @@ func (t *Topology) StartRefreshWritableVolumes(grpcDialOption grpc.DialOption, g
}
}()
go func(garbageThreshold float64) {
- c := time.Tick(15 * time.Minute)
- for _ = range c {
+ for {
if t.IsLeader() {
t.Vacuum(grpcDialOption, garbageThreshold, 0, "", preallocate)
+ } else {
+ stats.MasterReplicaPlacementMismatch.Reset()
}
+ time.Sleep(14*time.Minute + time.Duration(120*rand.Float32())*time.Second)
}
}(garbageThreshold)
go func() {