Browse Source

volume.balance: add delay during tight loop

fix https://github.com/chrislusf/seaweedfs/issues/2637
pull/2652/head
chrislu 3 years ago
parent
commit
f18803424a
  1. 2
      weed/shell/command_collection_list.go
  2. 2
      weed/shell/command_ec_common.go
  3. 9
      weed/shell/command_ec_decode.go
  4. 2
      weed/shell/command_ec_encode.go
  5. 2
      weed/shell/command_s3_bucket_list.go
  6. 2
      weed/shell/command_s3_bucket_quota_check.go
  7. 2
      weed/shell/command_volume_balance.go
  8. 2
      weed/shell/command_volume_check_disk.go
  9. 2
      weed/shell/command_volume_configure_replication.go
  10. 2
      weed/shell/command_volume_delete_empty.go
  11. 2
      weed/shell/command_volume_fix_replication.go
  12. 2
      weed/shell/command_volume_fsck.go
  13. 2
      weed/shell/command_volume_list.go
  14. 2
      weed/shell/command_volume_server_evacuate.go
  15. 2
      weed/shell/command_volume_tier_download.go
  16. 2
      weed/shell/command_volume_tier_move.go

2
weed/shell/command_collection_list.go

@ -38,7 +38,7 @@ func (c *commandCollectionList) Do(args []string, commandEnv *CommandEnv, writer
return err
}
topologyInfo, _, err := collectTopologyInfo(commandEnv)
topologyInfo, _, err := collectTopologyInfo(commandEnv, 0)
if err != nil {
return err
}

2
weed/shell/command_ec_common.go

@ -206,7 +206,7 @@ func collectEcNodes(commandEnv *CommandEnv, selectedDataCenter string) (ecNodes
// list all possible locations
// collect topology information
topologyInfo, _, err := collectTopologyInfo(commandEnv)
topologyInfo, _, err := collectTopologyInfo(commandEnv, 0)
if err != nil {
return
}

9
weed/shell/command_ec_decode.go

@ -8,6 +8,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/pb"
"github.com/chrislusf/seaweedfs/weed/storage/types"
"io"
"time"
"google.golang.org/grpc"
@ -53,7 +54,7 @@ func (c *commandEcDecode) Do(args []string, commandEnv *CommandEnv, writer io.Wr
vid := needle.VolumeId(*volumeId)
// collect topology information
topologyInfo, _, err := collectTopologyInfo(commandEnv)
topologyInfo, _, err := collectTopologyInfo(commandEnv, 0)
if err != nil {
return err
}
@ -233,7 +234,11 @@ func lookupVolumeIds(commandEnv *CommandEnv, volumeIds []string) (volumeIdLocati
return resp.VolumeIdLocations, nil
}
func collectTopologyInfo(commandEnv *CommandEnv) (topoInfo *master_pb.TopologyInfo, volumeSizeLimitMb uint64, err error) {
func collectTopologyInfo(commandEnv *CommandEnv, delayBeforeCollecting time.Duration) (topoInfo *master_pb.TopologyInfo, volumeSizeLimitMb uint64, err error) {
if delayBeforeCollecting > 0 {
time.Sleep(delayBeforeCollecting)
}
var resp *master_pb.VolumeListResponse
err = commandEnv.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {

2
weed/shell/command_ec_encode.go

@ -267,7 +267,7 @@ func balancedEcDistribution(servers []*EcNode) (allocated [][]uint32) {
func collectVolumeIdsForEcEncode(commandEnv *CommandEnv, selectedCollection string, fullPercentage float64, quietPeriod time.Duration) (vids []needle.VolumeId, err error) {
// collect topology information
topologyInfo, volumeSizeLimitMb, err := collectTopologyInfo(commandEnv)
topologyInfo, volumeSizeLimitMb, err := collectTopologyInfo(commandEnv, 0)
if err != nil {
return
}

2
weed/shell/command_s3_bucket_list.go

@ -35,7 +35,7 @@ func (c *commandS3BucketList) Do(args []string, commandEnv *CommandEnv, writer i
}
// collect collection information
topologyInfo, _, err := collectTopologyInfo(commandEnv)
topologyInfo, _, err := collectTopologyInfo(commandEnv, 0)
if err != nil {
return err
}

2
weed/shell/command_s3_bucket_quota_check.go

@ -38,7 +38,7 @@ func (c *commandS3BucketQuotaEnforce) Do(args []string, commandEnv *CommandEnv,
}
// collect collection information
topologyInfo, _, err := collectTopologyInfo(commandEnv)
topologyInfo, _, err := collectTopologyInfo(commandEnv, 0)
if err != nil {
return err
}

2
weed/shell/command_volume_balance.go

@ -76,7 +76,7 @@ func (c *commandVolumeBalance) Do(args []string, commandEnv *CommandEnv, writer
}
// collect topology information
topologyInfo, volumeSizeLimitMb, err := collectTopologyInfo(commandEnv)
topologyInfo, volumeSizeLimitMb, err := collectTopologyInfo(commandEnv, 15*time.Second)
if err != nil {
return err
}

2
weed/shell/command_volume_check_disk.go

@ -58,7 +58,7 @@ func (c *commandVolumeCheckDisk) Do(args []string, commandEnv *CommandEnv, write
c.env = commandEnv
// collect topology information
topologyInfo, _, err := collectTopologyInfo(commandEnv)
topologyInfo, _, err := collectTopologyInfo(commandEnv, 0)
if err != nil {
return err
}

2
weed/shell/command_volume_configure_replication.go

@ -59,7 +59,7 @@ func (c *commandVolumeConfigureReplication) Do(args []string, commandEnv *Comman
}
// collect topology information
topologyInfo, _, err := collectTopologyInfo(commandEnv)
topologyInfo, _, err := collectTopologyInfo(commandEnv, 0)
if err != nil {
return err
}

2
weed/shell/command_volume_delete_empty.go

@ -45,7 +45,7 @@ func (c *commandVolumeDeleteEmpty) Do(args []string, commandEnv *CommandEnv, wri
}
// collect topology information
topologyInfo, _, err := collectTopologyInfo(commandEnv)
topologyInfo, _, err := collectTopologyInfo(commandEnv, 0)
if err != nil {
return err
}

2
weed/shell/command_volume_fix_replication.go

@ -75,7 +75,7 @@ func (c *commandVolumeFixReplication) Do(args []string, commandEnv *CommandEnv,
fixedVolumeReplicas := map[string]int{}
// collect topology information
topologyInfo, _, err := collectTopologyInfo(commandEnv)
topologyInfo, _, err := collectTopologyInfo(commandEnv, 15*time.Second)
if err != nil {
return err
}

2
weed/shell/command_volume_fsck.go

@ -455,7 +455,7 @@ func (c *commandVolumeFsck) collectVolumeIds(commandEnv *CommandEnv, verbose boo
volumeIdToServer = make(map[uint32]VInfo)
// collect topology information
topologyInfo, _, err := collectTopologyInfo(commandEnv)
topologyInfo, _, err := collectTopologyInfo(commandEnv, 0)
if err != nil {
return
}

2
weed/shell/command_volume_list.go

@ -39,7 +39,7 @@ func (c *commandVolumeList) Do(args []string, commandEnv *CommandEnv, writer io.
}
// collect topology information
topologyInfo, volumeSizeLimitMb, err := collectTopologyInfo(commandEnv)
topologyInfo, volumeSizeLimitMb, err := collectTopologyInfo(commandEnv, 0)
if err != nil {
return err
}

2
weed/shell/command_volume_server_evacuate.go

@ -78,7 +78,7 @@ func volumeServerEvacuate(commandEnv *CommandEnv, volumeServer string, skipNonMo
// list all the volumes
// collect topology information
topologyInfo, _, err := collectTopologyInfo(commandEnv)
topologyInfo, _, err := collectTopologyInfo(commandEnv, 0)
if err != nil {
return err
}

2
weed/shell/command_volume_tier_download.go

@ -57,7 +57,7 @@ func (c *commandVolumeTierDownload) Do(args []string, commandEnv *CommandEnv, wr
vid := needle.VolumeId(*volumeId)
// collect topology information
topologyInfo, _, err := collectTopologyInfo(commandEnv)
topologyInfo, _, err := collectTopologyInfo(commandEnv, 0)
if err != nil {
return err
}

2
weed/shell/command_volume_tier_move.go

@ -74,7 +74,7 @@ func (c *commandVolumeTierMove) Do(args []string, commandEnv *CommandEnv, writer
}
// collect topology information
topologyInfo, volumeSizeLimitMb, err := collectTopologyInfo(commandEnv)
topologyInfo, volumeSizeLimitMb, err := collectTopologyInfo(commandEnv, 0)
if err != nil {
return err
}

Loading…
Cancel
Save