Accept 'Join' messages from nodes without dc (#23822)

* Accept 'Join' messages from nodes without dc

To allow a join from a 2.4 node to a 2.5.6 cluster.

* Use "ClusterSettings.DefaultDataCenter" constant
This commit is contained in:
Arnout Engelen 2017-10-23 11:49:51 +02:00 committed by Konrad `ktoso` Malawski
parent e4980b323c
commit 9cb5849188
2 changed files with 12 additions and 4 deletions

View file

@ -49,7 +49,7 @@ class ClusterMessageSerializerSpec extends AkkaSpec(
val uniqueAddress = UniqueAddress(address, 17L)
val address2 = Address("akka.tcp", "system", "other.host.org", 4711)
val uniqueAddress2 = UniqueAddress(address2, 18L)
checkSerialization(InternalClusterAction.Join(uniqueAddress, Set("foo", "bar")))
checkSerialization(InternalClusterAction.Join(uniqueAddress, Set("foo", "bar", "dc-A")))
checkSerialization(ClusterUserAction.Leave(address))
checkSerialization(ClusterUserAction.Down(address))
checkSerialization(InternalClusterAction.InitJoin)
@ -115,11 +115,16 @@ class ClusterMessageSerializerSpec extends AkkaSpec(
}
"add a default data center role if none is present" in {
"add a default data center role to gossip if none is present" in {
val env = roundtrip(GossipEnvelope(a1.uniqueAddress, d1.uniqueAddress, Gossip(SortedSet(a1, d1))))
env.gossip.members.head.roles should be(Set(ClusterSettings.DcRolePrefix + "default"))
env.gossip.members.tail.head.roles should be(Set("r1", ClusterSettings.DcRolePrefix + "foo"))
}
"add a default data center role to internal join action if none is present" in {
val join = roundtrip(InternalClusterAction.Join(a1.uniqueAddress, Set()))
join.roles should be(Set(ClusterSettings.DcRolePrefix + "default"))
}
}
"Cluster router pool" must {
"be serializable with no role" in {