Buffer LeaderChanged events and publish all on convergence, see #3017

* Otherwise some changes might never be published, since it doesn't have
  to be convergence on all nodes inbetween all transitions.
* Detected by a failure ClusterSingletonManagerSpec.
* Added a test to simulate the failure scenario.
This commit is contained in:
Patrik Nordwall 2013-02-08 09:17:55 +01:00
parent 4ee299c729
commit d32a2edc51
3 changed files with 80 additions and 44 deletions

View file

@ -283,8 +283,17 @@ class ClusterSingletonManagerSpec extends MultiNodeSpec(ClusterSingletonManagerS
verify(newLeaderRole, msg = 3, expectedCurrent = 2)
}
"hand over when adding three new potential leaders to 3 nodes cluster" in within(30 seconds) {
"hand over when adding three new potential leaders to 3 nodes cluster" in within(60 seconds) {
// this test will result in restart after retry timeout
// because the new leader will not know about the real previous leader and the
// previous leader sortedClusterRoles(3) will first think that sortedClusterRoles(2)
// is the new leader
runOn(controller) {
queue ! Reset
expectMsg(ResetOk)
}
runOn(sortedClusterRoles(2)) {
// previous leader
Cluster(system) join node(sortedClusterRoles(3)).address
createSingleton()
}
@ -297,7 +306,7 @@ class ClusterSingletonManagerSpec extends MultiNodeSpec(ClusterSingletonManagerS
createSingleton()
}
verify(sortedClusterRoles(0), msg = 4, expectedCurrent = 3)
verify(sortedClusterRoles(0), msg = 4, expectedCurrent = 0)
}
"hand over when leader leaves in 6 nodes cluster " in within(30 seconds) {