Change cluster MemberEvents to only be published on convergence. See #2692

Conflicts:
	akka-cluster/src/main/scala/akka/cluster/ClusterEvent.scala
	akka-cluster/src/main/scala/akka/cluster/ClusterJmx.scala
	akka-cluster/src/main/scala/akka/cluster/ClusterMetricsCollector.scala
	akka-cluster/src/main/scala/akka/cluster/ClusterReadView.scala
	akka-cluster/src/multi-jvm/scala/akka/cluster/MultiNodeClusterSpec.scala
	akka-docs/rst/cluster/cluster-usage-java.rst
	akka-docs/rst/cluster/cluster-usage-scala.rst
	akka-kernel/src/main/dist/bin/akka-cluster
This commit is contained in:
Björn Antonsson 2012-11-27 18:07:37 +01:00
parent 0c9ad2f791
commit a03460329d
21 changed files with 327 additions and 304 deletions

View file

@ -181,7 +181,6 @@ abstract class LargeClusterSpec
Await.ready(latch, remaining)
awaitCond(clusterNodes.forall(_.readView.convergence))
val counts = clusterNodes.map(gossipCount(_))
val formattedStats = "mean=%s min=%s max=%s".format(counts.sum / clusterNodes.size, counts.min, counts.max)
log.info("Convergence of [{}] nodes reached, it took [{}], received [{}] gossip messages per node",
@ -278,7 +277,7 @@ abstract class LargeClusterSpec
}
"detect failure and auto-down crashed nodes in second-datacenter" taggedAs LongRunningTest in {
val unreachableNodes = nodesPerDatacenter
val downedNodes = nodesPerDatacenter
val liveNodes = nodesPerDatacenter * 4
within(30.seconds + 3.seconds * liveNodes) {
@ -293,22 +292,19 @@ abstract class LargeClusterSpec
val latch = TestLatch(nodesPerDatacenter)
systems foreach { sys
Cluster(sys).subscribe(sys.actorOf(Props(new Actor {
var gotUnreachable = Set.empty[Member]
var gotDowned = Set.empty[Member]
def receive = {
case state: CurrentClusterState
gotUnreachable = state.unreachable
checkDone()
case MemberUnreachable(m) if !latch.isOpen
gotUnreachable = gotUnreachable + m
gotDowned = gotDowned ++ state.unreachable.filter(_.status == Down)
checkDone()
case MemberDowned(m) if !latch.isOpen
gotUnreachable = gotUnreachable + m
gotDowned = gotDowned + m
checkDone()
case _ // not interesting
}
def checkDone(): Unit = if (gotUnreachable.size == unreachableNodes) {
log.info("Detected [{}] unreachable nodes in [{}], it took [{}], received [{}] gossip messages",
unreachableNodes, Cluster(sys).selfAddress, tookMillis, gossipCount(Cluster(sys)))
def checkDone(): Unit = if (gotDowned.size == downedNodes) {
log.info("Detected [{}] downed nodes in [{}], it took [{}], received [{}] gossip messages",
downedNodes, Cluster(sys).selfAddress, tookMillis, gossipCount(Cluster(sys)))
latch.countDown()
}
})), classOf[ClusterDomainEvent])
@ -322,7 +318,6 @@ abstract class LargeClusterSpec
runOn(firstDatacenter, thirdDatacenter, fourthDatacenter, fifthDatacenter) {
Await.ready(latch, remaining)
awaitCond(systems.forall(Cluster(_).readView.convergence))
val mergeCount = systems.map(sys Cluster(sys).readView.latestStats.mergeCount).sum
val counts = systems.map(sys gossipCount(Cluster(sys)))
val formattedStats = "mean=%s min=%s max=%s".format(counts.sum / nodesPerDatacenter, counts.min, counts.max)