Skip to content

Commit

Permalink
possible fix for volume balance
Browse files Browse the repository at this point in the history
address #1534
  • Loading branch information
chrislusf committed Mar 15, 2021
1 parent 35d939a commit 29e62ab
Show file tree
Hide file tree
Showing 3 changed files with 905 additions and 1 deletion.
2 changes: 1 addition & 1 deletion weed/shell/command_volume_balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ type CapacityFunc func(*master_pb.DataNodeInfo) int

func capacityByMaxVolumeCount(diskType types.DiskType) CapacityFunc {
return func(info *master_pb.DataNodeInfo) int {
diskInfo, found := info.DiskInfos[string(diskType)]
diskInfo, found := info.DiskInfos[diskType.ReadableString()]
if !found {
return 0
}
Expand Down
12 changes: 12 additions & 0 deletions weed/shell/command_volume_balance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,15 @@ func TestIsGoodMove(t *testing.T) {
}

}

func TestBalance(t *testing.T) {
topologyInfo := parseOutput(topoData)
volumeServers := collectVolumeServersByDc(topologyInfo, "")
volumeReplicas, _ := collectVolumeReplicaLocations(topologyInfo)
diskTypes := collectVolumeDiskTypes(topologyInfo)

if err := balanceVolumeServers(nil, diskTypes, volumeReplicas, volumeServers, 30*1024*1024*1024, "ALL_COLLECTIONS", false); err != nil {
t.Errorf("balance: %v", err)
}

}

0 comments on commit 29e62ab

Please sign in to comment.