mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-12-29 10:59:02 +08:00
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:
@@ -45,6 +45,15 @@ func NewReplicaPlacementFromByte(b byte) (*ReplicaPlacement, error) {
|
||||
return NewReplicaPlacementFromString(fmt.Sprintf("%03d", b))
|
||||
}
|
||||
|
||||
func (a *ReplicaPlacement) Equals(b *ReplicaPlacement) bool {
|
||||
if a == nil || b == nil {
|
||||
return false
|
||||
}
|
||||
return (a.SameRackCount == b.SameRackCount &&
|
||||
a.DiffRackCount == b.DiffRackCount &&
|
||||
a.DiffDataCenterCount == b.DiffDataCenterCount)
|
||||
}
|
||||
|
||||
func (rp *ReplicaPlacement) Byte() byte {
|
||||
if rp == nil {
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user