Browse Source
rand start garbageThreshold and reset metric ReplicaPlacementMismatch (#3396)
* rand start garbageThreshold
reset metrics MasterReplicaPlacementMismatch
* vacuum through sleep
pull/3481/head
Konstantin Lebedev
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
5 additions and
2 deletions
-
weed/topology/topology_event_handling.go
|
@ -1,6 +1,7 @@ |
|
|
package topology |
|
|
package topology |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
|
|
|
"github.com/seaweedfs/seaweedfs/weed/stats" |
|
|
"github.com/seaweedfs/seaweedfs/weed/storage/erasure_coding" |
|
|
"github.com/seaweedfs/seaweedfs/weed/storage/erasure_coding" |
|
|
"github.com/seaweedfs/seaweedfs/weed/storage/types" |
|
|
"github.com/seaweedfs/seaweedfs/weed/storage/types" |
|
|
"google.golang.org/grpc" |
|
|
"google.golang.org/grpc" |
|
@ -22,11 +23,13 @@ func (t *Topology) StartRefreshWritableVolumes(grpcDialOption grpc.DialOption, g |
|
|
} |
|
|
} |
|
|
}() |
|
|
}() |
|
|
go func(garbageThreshold float64) { |
|
|
go func(garbageThreshold float64) { |
|
|
c := time.Tick(15 * time.Minute) |
|
|
|
|
|
for _ = range c { |
|
|
|
|
|
|
|
|
for { |
|
|
if t.IsLeader() { |
|
|
if t.IsLeader() { |
|
|
t.Vacuum(grpcDialOption, garbageThreshold, 0, "", preallocate) |
|
|
t.Vacuum(grpcDialOption, garbageThreshold, 0, "", preallocate) |
|
|
|
|
|
} else { |
|
|
|
|
|
stats.MasterReplicaPlacementMismatch.Reset() |
|
|
} |
|
|
} |
|
|
|
|
|
time.Sleep(14*time.Minute + time.Duration(120*rand.Float32())*time.Second) |
|
|
} |
|
|
} |
|
|
}(garbageThreshold) |
|
|
}(garbageThreshold) |
|
|
go func() { |
|
|
go func() { |
|
|