Moved GossipDifferentViewProbability to config, see #2253

This commit is contained in:
Patrik Nordwall 2012-06-29 08:56:58 +02:00
parent 211732391d
commit d47ff04c03
4 changed files with 8 additions and 3 deletions

View file

@ -52,6 +52,11 @@ akka {
# of the cluster within this deadline.
join-timeout = 60s
# Gossip to random node with newer or older state information, if any with some
# this probability. Otherwise Gossip to any random live node.
# Probability value is between 0.0 and 1.0. 0.0 means never, 1.0 means always.
gossip-different-view-probability = 0.8
failure-detector {
# defines the failure detector threshold

View file

@ -1066,8 +1066,6 @@ class Cluster(system: ExtendedActorSystem, val failureDetector: FailureDetector)
}
}
private def gossipToDifferentViewProbability: Double = 0.8
/**
* INTERNAL API.
*
@ -1099,7 +1097,7 @@ class Cluster(system: ExtendedActorSystem, val failureDetector: FailureDetector)
} yield address
}
val gossipedToAlive =
if (nodesWithdifferentView.nonEmpty && ThreadLocalRandom.current.nextDouble() < gossipToDifferentViewProbability)
if (nodesWithdifferentView.nonEmpty && ThreadLocalRandom.current.nextDouble() < GossipDifferentViewProbability)
gossipToRandomNodeOf(nodesWithdifferentView.toIndexedSeq)
else
gossipToRandomNodeOf(localMemberAddresses)

View file

@ -36,6 +36,7 @@ class ClusterSettings(val config: Config, val systemName: String) {
final val AutoJoin: Boolean = getBoolean("akka.cluster.auto-join")
final val AutoDown: Boolean = getBoolean("akka.cluster.auto-down")
final val JoinTimeout: Duration = Duration(getMilliseconds("akka.cluster.join-timeout"), MILLISECONDS)
final val GossipDifferentViewProbability: Double = getDouble("akka.cluster.gossip-different-view-probability")
final val SchedulerTickDuration: Duration = Duration(getMilliseconds("akka.cluster.scheduler.tick-duration"), MILLISECONDS)
final val SchedulerTicksPerWheel: Int = getInt("akka.cluster.scheduler.ticks-per-wheel")
}

View file

@ -32,6 +32,7 @@ class ClusterConfigSpec extends AkkaSpec {
NrOfGossipDaemons must be(4)
AutoJoin must be(true)
AutoDown must be(true)
GossipDifferentViewProbability must be(0.8 plusOrMinus 0.0001)
SchedulerTickDuration must be(33 millis)
SchedulerTicksPerWheel must be(512)
}