Introduce logic to resolve volume replica placement within EC rebalancing. (#6254)
* Rename `command_ec_encode_test.go` to `command_ec_common_test.go`. All tests defined in this file are now for `command_ec_common.go`. * Minor code cleanups. - Fix broken `ec.balance` test. - Rework integer ceiling division to not use floats, which can introduce precision errors. * Introduce logic to resolve volume replica placement within EC rebalancing. This will be used to make rebalancing logic topology-aware. * Give shell.EcNode.dc a dedicated DataCenterId type.
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/seaweedfs/seaweedfs/weed/storage/erasure_coding"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestEcDistribution(t *testing.T) {
|
||||
|
||||
topologyInfo := parseOutput(topoData)
|
||||
|
||||
// find out all volume servers with one slot left.
|
||||
ecNodes, totalFreeEcSlots := collectEcVolumeServersByDc(topologyInfo, "")
|
||||
|
||||
sortEcNodesByFreeslotsDescending(ecNodes)
|
||||
|
||||
if totalFreeEcSlots < erasure_coding.TotalShardsCount {
|
||||
println("not enough free ec shard slots", totalFreeEcSlots)
|
||||
}
|
||||
allocatedDataNodes := ecNodes
|
||||
if len(allocatedDataNodes) > erasure_coding.TotalShardsCount {
|
||||
allocatedDataNodes = allocatedDataNodes[:erasure_coding.TotalShardsCount]
|
||||
}
|
||||
|
||||
for _, dn := range allocatedDataNodes {
|
||||
// fmt.Printf("info %+v %+v\n", dn.info, dn)
|
||||
fmt.Printf("=> %+v %+v\n", dn.info.Id, dn.freeEcSlot)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user