mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-11-28 13:31:27 +08:00
test for multi dc replication
This commit is contained in:
parent
e60b2117c3
commit
12a8f5294d
@ -299,7 +299,7 @@ func isGoodMove(placement *super_block.ReplicaPlacement, existingReplicas []*Vol
|
||||
return false
|
||||
}
|
||||
|
||||
if len(racks) > placement.DiffRackCount+1 {
|
||||
if len(racks) > placement.DiffRackCount+placement.DiffDataCenterCount+1 {
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,24 @@ type testMoveCase struct {
|
||||
func TestIsGoodMove(t *testing.T) {
|
||||
|
||||
var tests = []testMoveCase{
|
||||
|
||||
|
||||
{
|
||||
name: "test 100 move to spread into proper data centers",
|
||||
replication: "100",
|
||||
replicas: []*VolumeReplica{
|
||||
{
|
||||
location: &location{"dc1", "r1", &master_pb.DataNodeInfo{Id: "dn1"}},
|
||||
},
|
||||
{
|
||||
location: &location{"dc1", "r2", &master_pb.DataNodeInfo{Id: "dn2"}},
|
||||
},
|
||||
},
|
||||
sourceLocation: location{"dc1", "r2", &master_pb.DataNodeInfo{Id: "dn2"}},
|
||||
targetLocation: location{"dc2", "r2", &master_pb.DataNodeInfo{Id: "dn3"}},
|
||||
expected: true,
|
||||
},
|
||||
|
||||
{
|
||||
name: "test move to the same node",
|
||||
replication: "001",
|
||||
|
Loading…
Reference in New Issue
Block a user