Hardening of another corner case in cluster singleton, see #3017

* It was an unlikely situatation that was not covered,
  the new leader didn't know previous, because it transitioned
  from Start -> BecomeLeader, old leader was removed and got
  LeaderChanged(None), so none of them could request the other
  for hand-over or take-over.
* Taken care of with the retry timeouts, also when leader
  receives LeaderChanged(None)
* The old leader should have received a propert LeaderChanged
  earlier, which is a flaw in the way we publish leader events.
  That part will be fixed in a separate commit.
This commit is contained in:
Patrik Nordwall 2013-02-07 14:25:29 +01:00
parent a31d98340f
commit 4ee299c729
2 changed files with 18 additions and 19 deletions

View file

@ -155,12 +155,12 @@ object ClusterSingletonManagerSpec extends MultiNodeConfig {
def receive = {
case state: CurrentClusterState leaderAddress = state.leader
case LeaderChanged(leader) leaderAddress = leader
case other => consumer foreach { _ forward other }
case LeaderChanged(leader) leaderAddress = leader
case other consumer foreach { _ forward other }
}
def consumer: Option[ActorRef] =
leaderAddress map (a => context.actorFor(RootActorPath(a) /
leaderAddress map (a context.actorFor(RootActorPath(a) /
"user" / "singleton" / "consumer"))
}
//#singleton-proxy
@ -300,7 +300,7 @@ class ClusterSingletonManagerSpec extends MultiNodeSpec(ClusterSingletonManagerS
verify(sortedClusterRoles(0), msg = 4, expectedCurrent = 3)
}
"hand over when leader leaves in 6 nodes cluster " in within(20 seconds) {
"hand over when leader leaves in 6 nodes cluster " in within(30 seconds) {
//#test-leave
val leaveRole = sortedClusterRoles(0)
val newLeaderRole = sortedClusterRoles(1)