=clu #18337 Disable down-removal-margin by default

For manual downing it is not needed. For auto-down it doesn't add any extra safety, since that
is not handling network partitions anyway.

The setting is still useful if you implement downing strategies that handle network partitions,
e.g. by keeping the larger side of the partition and shutting down the smaller side.
This commit is contained in:
Patrik Nordwall 2015-08-27 12:46:45 +02:00
parent baa4399521
commit bfde1eff19
7 changed files with 17 additions and 8 deletions

View file

@ -58,7 +58,6 @@ abstract class ClusterShardingFailureSpecConfig(val mode: String) extends MultiN
akka.actor.provider = "akka.cluster.ClusterActorRefProvider" akka.actor.provider = "akka.cluster.ClusterActorRefProvider"
akka.remote.log-remote-lifecycle-events = off akka.remote.log-remote-lifecycle-events = off
akka.cluster.auto-down-unreachable-after = 0s akka.cluster.auto-down-unreachable-after = 0s
akka.cluster.down-removal-margin = 5s
akka.cluster.roles = ["backend"] akka.cluster.roles = ["backend"]
akka.persistence.journal.plugin = "akka.persistence.journal.leveldb-shared" akka.persistence.journal.plugin = "akka.persistence.journal.leveldb-shared"
akka.persistence.journal.leveldb-shared { akka.persistence.journal.leveldb-shared {

View file

@ -66,7 +66,6 @@ abstract class ClusterShardingLeavingSpecConfig(val mode: String) extends MultiN
akka.actor.provider = "akka.cluster.ClusterActorRefProvider" akka.actor.provider = "akka.cluster.ClusterActorRefProvider"
akka.remote.log-remote-lifecycle-events = off akka.remote.log-remote-lifecycle-events = off
akka.cluster.auto-down-unreachable-after = 0s akka.cluster.auto-down-unreachable-after = 0s
akka.cluster.down-removal-margin = 5s
akka.persistence.journal.plugin = "akka.persistence.journal.leveldb-shared" akka.persistence.journal.plugin = "akka.persistence.journal.leveldb-shared"
akka.persistence.journal.leveldb-shared { akka.persistence.journal.leveldb-shared {
timeout = 5s timeout = 5s

View file

@ -111,7 +111,6 @@ abstract class ClusterShardingSpecConfig(val mode: String) extends MultiNodeConf
akka.actor.provider = "akka.cluster.ClusterActorRefProvider" akka.actor.provider = "akka.cluster.ClusterActorRefProvider"
akka.remote.log-remote-lifecycle-events = off akka.remote.log-remote-lifecycle-events = off
akka.cluster.auto-down-unreachable-after = 0s akka.cluster.auto-down-unreachable-after = 0s
akka.cluster.down-removal-margin = 5s
akka.cluster.roles = ["backend"] akka.cluster.roles = ["backend"]
akka.cluster.distributed-data.gossip-interval = 1s akka.cluster.distributed-data.gossip-interval = 1s
akka.persistence.journal.plugin = "akka.persistence.journal.leveldb-shared" akka.persistence.journal.plugin = "akka.persistence.journal.leveldb-shared"

View file

@ -556,8 +556,11 @@ class ClusterSingletonManager(
} }
def scheduleDelayedMemberRemoved(m: Member): Unit = { def scheduleDelayedMemberRemoved(m: Member): Unit = {
log.debug("Schedule DelayedMemberRemoved for [{}]", m.address) if (removalMargin > Duration.Zero) {
context.system.scheduler.scheduleOnce(removalMargin, self, DelayedMemberRemoved(m))(context.dispatcher) log.debug("Schedule DelayedMemberRemoved for [{}]", m.address)
context.system.scheduler.scheduleOnce(removalMargin, self, DelayedMemberRemoved(m))(context.dispatcher)
} else
self ! DelayedMemberRemoved(m)
} }
def gotoOldest(): State = { def gotoOldest(): State = {

View file

@ -29,11 +29,16 @@ akka {
# Disable with "off" or specify a duration to enable auto-down. # Disable with "off" or specify a duration to enable auto-down.
auto-down-unreachable-after = off auto-down-unreachable-after = off
# Margin until shards or singletons that belonged to a downed/removed # Time margin after which shards or singletons that belonged to a downed/removed
# partition are created in surviving partition. The purpose of this margin is that # partition are created in surviving partition. The purpose of this margin is that
# in case of a network partition the persistent actors in the non-surviving partitions # in case of a network partition the persistent actors in the non-surviving partitions
# must be stopped before corresponding persistent actors are started somewhere else. # must be stopped before corresponding persistent actors are started somewhere else.
down-removal-margin = 20s # This is useful if you implement downing strategies that handle network partitions,
# e.g. by keeping the larger side of the partition and shutting down the smaller side.
# It will not add any extra safety for auto-down-unreachable-after, since that is not
# handling network partitions.
# Disable with "off" or specify a duration to enable.
down-removal-margin = off
# The roles of this member. List of strings, e.g. roles = ["A", "B"]. # The roles of this member. List of strings, e.g. roles = ["A", "B"].
# The roles are part of the membership information and can be used by # The roles are part of the membership information and can be used by

View file

@ -69,7 +69,10 @@ final class ClusterSettings(val config: Config, val systemName: String) {
val DownRemovalMargin: FiniteDuration = { val DownRemovalMargin: FiniteDuration = {
val key = "down-removal-margin" val key = "down-removal-margin"
cc.getMillisDuration(key) requiring (_ > Duration.Zero, key + " > 0s") cc.getString(key).toLowerCase(Locale.ROOT) match {
case "off" Duration.Zero
case _ cc.getMillisDuration(key) requiring (_ >= Duration.Zero, key + " >= 0s, or off")
}
} }
val Roles: Set[String] = immutableSeq(cc.getStringList("roles")).toSet val Roles: Set[String] = immutableSeq(cc.getStringList("roles")).toSet

View file

@ -39,6 +39,7 @@ class ClusterConfigSpec extends AkkaSpec {
UnreachableNodesReaperInterval should ===(1 second) UnreachableNodesReaperInterval should ===(1 second)
PublishStatsInterval should ===(Duration.Undefined) PublishStatsInterval should ===(Duration.Undefined)
AutoDownUnreachableAfter should ===(Duration.Undefined) AutoDownUnreachableAfter should ===(Duration.Undefined)
DownRemovalMargin should ===(Duration.Zero)
MinNrOfMembers should ===(1) MinNrOfMembers should ===(1)
MinNrOfMembersOfRole should ===(Map.empty[String, Int]) MinNrOfMembersOfRole should ===(Map.empty[String, Int])
Roles should ===(Set.empty[String]) Roles should ===(Set.empty[String])