Browse Source

refactor

pull/5990/head
chrislu 4 months ago
parent
commit
accba3070a
  1. 4
      weed/server/master_grpc_server_volume.go
  2. 6
      weed/topology/volume_growth.go

4
weed/server/master_grpc_server_volume.go

@ -4,7 +4,6 @@ import (
"context"
"fmt"
"math/rand/v2"
"reflect"
"strings"
"sync"
"time"
@ -92,7 +91,8 @@ func (ms *MasterServer) ProcessGrowRequest() {
// filter out identical requests being processed
found := false
filter.Range(func(k, v interface{}) bool {
if reflect.DeepEqual(k, req) {
existingReq := k.(*topology.VolumeGrowRequest)
if existingReq.Equals(req) {
found = true
}
return !found

6
weed/topology/volume_growth.go

@ -5,6 +5,7 @@ import (
"fmt"
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
"math/rand/v2"
"reflect"
"sync"
"time"
@ -29,6 +30,11 @@ type VolumeGrowRequest struct {
Option *VolumeGrowOption
Count uint32
Force bool
Reason string
}
func (vg *VolumeGrowRequest) Equals(req *VolumeGrowRequest) bool {
return reflect.DeepEqual(existingReq.Option, req.Option) && vg.Count == req.Count
}
type volumeGrowthStrategy struct {

Loading…
Cancel
Save