2012-05-28 11:06:02 +02:00
|
|
|
/**
|
|
|
|
|
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
|
|
|
|
|
*/
|
|
|
|
|
package akka.cluster
|
|
|
|
|
|
|
|
|
|
import com.typesafe.config.ConfigFactory
|
|
|
|
|
import akka.remote.testkit.MultiNodeConfig
|
|
|
|
|
import akka.remote.testkit.MultiNodeSpec
|
|
|
|
|
import akka.testkit._
|
2012-06-10 16:53:17 +02:00
|
|
|
import akka.actor._
|
2012-06-29 13:33:20 +02:00
|
|
|
import scala.concurrent.util.duration._
|
2012-05-28 11:06:02 +02:00
|
|
|
|
|
|
|
|
object LeaderDowningNodeThatIsUnreachableMultiJvmSpec extends MultiNodeConfig {
|
2012-05-28 15:38:39 +02:00
|
|
|
val first = role("first")
|
2012-05-28 11:06:02 +02:00
|
|
|
val second = role("second")
|
2012-05-28 15:38:39 +02:00
|
|
|
val third = role("third")
|
2012-05-28 11:06:02 +02:00
|
|
|
val fourth = role("fourth")
|
|
|
|
|
|
2012-06-10 16:53:17 +02:00
|
|
|
commonConfig(debugConfig(on = false).
|
2012-06-11 16:48:19 +02:00
|
|
|
withFallback(ConfigFactory.parseString("akka.cluster.auto-down = on")).
|
2012-05-28 11:06:02 +02:00
|
|
|
withFallback(MultiNodeClusterSpec.clusterConfig))
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-11 14:32:17 +02:00
|
|
|
class LeaderDowningNodeThatIsUnreachableWithFailureDetectorPuppetMultiJvmNode1 extends LeaderDowningNodeThatIsUnreachableSpec with FailureDetectorPuppetStrategy
|
|
|
|
|
class LeaderDowningNodeThatIsUnreachableWithFailureDetectorPuppetMultiJvmNode2 extends LeaderDowningNodeThatIsUnreachableSpec with FailureDetectorPuppetStrategy
|
|
|
|
|
class LeaderDowningNodeThatIsUnreachableWithFailureDetectorPuppetMultiJvmNode3 extends LeaderDowningNodeThatIsUnreachableSpec with FailureDetectorPuppetStrategy
|
|
|
|
|
class LeaderDowningNodeThatIsUnreachableWithFailureDetectorPuppetMultiJvmNode4 extends LeaderDowningNodeThatIsUnreachableSpec with FailureDetectorPuppetStrategy
|
2012-05-28 11:06:02 +02:00
|
|
|
|
2012-06-11 14:32:17 +02:00
|
|
|
class LeaderDowningNodeThatIsUnreachableWithAccrualFailureDetectorMultiJvmNode1 extends LeaderDowningNodeThatIsUnreachableSpec with AccrualFailureDetectorStrategy
|
|
|
|
|
class LeaderDowningNodeThatIsUnreachableWithAccrualFailureDetectorMultiJvmNode2 extends LeaderDowningNodeThatIsUnreachableSpec with AccrualFailureDetectorStrategy
|
|
|
|
|
class LeaderDowningNodeThatIsUnreachableWithAccrualFailureDetectorMultiJvmNode3 extends LeaderDowningNodeThatIsUnreachableSpec with AccrualFailureDetectorStrategy
|
|
|
|
|
class LeaderDowningNodeThatIsUnreachableWithAccrualFailureDetectorMultiJvmNode4 extends LeaderDowningNodeThatIsUnreachableSpec with AccrualFailureDetectorStrategy
|
|
|
|
|
|
|
|
|
|
abstract class LeaderDowningNodeThatIsUnreachableSpec
|
2012-05-28 11:06:02 +02:00
|
|
|
extends MultiNodeSpec(LeaderDowningNodeThatIsUnreachableMultiJvmSpec)
|
2012-06-04 23:21:28 +02:00
|
|
|
with MultiNodeClusterSpec {
|
|
|
|
|
|
2012-05-28 11:06:02 +02:00
|
|
|
import LeaderDowningNodeThatIsUnreachableMultiJvmSpec._
|
|
|
|
|
|
|
|
|
|
"The Leader in a 4 node cluster" must {
|
|
|
|
|
|
|
|
|
|
"be able to DOWN a 'last' node that is UNREACHABLE" taggedAs LongRunningTest in {
|
2012-06-05 14:13:44 +02:00
|
|
|
awaitClusterUp(first, second, third, fourth)
|
2012-05-28 11:06:02 +02:00
|
|
|
|
2012-06-18 11:54:44 +02:00
|
|
|
val fourthAddress = address(fourth)
|
2012-06-05 14:13:44 +02:00
|
|
|
runOn(first) {
|
2012-05-28 11:06:02 +02:00
|
|
|
// kill 'fourth' node
|
|
|
|
|
testConductor.shutdown(fourth, 0)
|
2012-06-15 14:39:47 +02:00
|
|
|
enterBarrier("down-fourth-node")
|
2012-05-28 11:06:02 +02:00
|
|
|
|
2012-06-10 16:53:17 +02:00
|
|
|
// mark the node as unreachable in the failure detector
|
2012-06-11 14:32:17 +02:00
|
|
|
markNodeAsUnavailable(fourthAddress)
|
2012-06-10 16:53:17 +02:00
|
|
|
|
2012-05-28 11:06:02 +02:00
|
|
|
// --- HERE THE LEADER SHOULD DETECT FAILURE AND AUTO-DOWN THE UNREACHABLE NODE ---
|
|
|
|
|
|
2012-05-30 17:17:09 +02:00
|
|
|
awaitUpConvergence(numberOfMembers = 3, canNotBePartOfMemberRing = Seq(fourthAddress), 30.seconds)
|
2012-05-28 11:06:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
runOn(fourth) {
|
2012-06-15 14:39:47 +02:00
|
|
|
enterBarrier("down-fourth-node")
|
2012-05-28 11:06:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
runOn(second, third) {
|
2012-06-15 14:39:47 +02:00
|
|
|
enterBarrier("down-fourth-node")
|
2012-05-28 11:06:02 +02:00
|
|
|
|
2012-05-30 17:17:09 +02:00
|
|
|
awaitUpConvergence(numberOfMembers = 3, canNotBePartOfMemberRing = Seq(fourthAddress), 30.seconds)
|
2012-05-28 11:06:02 +02:00
|
|
|
}
|
2012-06-05 14:13:44 +02:00
|
|
|
|
2012-06-15 14:39:47 +02:00
|
|
|
enterBarrier("await-completion-1")
|
2012-05-28 11:06:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
"be able to DOWN a 'middle' node that is UNREACHABLE" taggedAs LongRunningTest in {
|
2012-06-18 11:54:44 +02:00
|
|
|
val secondAddress = address(second)
|
2012-05-28 11:06:02 +02:00
|
|
|
|
2012-06-15 14:39:47 +02:00
|
|
|
enterBarrier("before-down-second-node")
|
2012-06-05 14:13:44 +02:00
|
|
|
runOn(first) {
|
2012-05-28 11:06:02 +02:00
|
|
|
// kill 'second' node
|
|
|
|
|
testConductor.shutdown(second, 0)
|
2012-06-15 14:39:47 +02:00
|
|
|
enterBarrier("down-second-node")
|
2012-05-28 11:06:02 +02:00
|
|
|
|
2012-06-10 16:53:17 +02:00
|
|
|
// mark the node as unreachable in the failure detector
|
2012-06-11 14:32:17 +02:00
|
|
|
markNodeAsUnavailable(secondAddress)
|
2012-06-10 16:53:17 +02:00
|
|
|
|
2012-05-28 11:06:02 +02:00
|
|
|
// --- HERE THE LEADER SHOULD DETECT FAILURE AND AUTO-DOWN THE UNREACHABLE NODE ---
|
|
|
|
|
|
2012-05-30 17:17:09 +02:00
|
|
|
awaitUpConvergence(numberOfMembers = 2, canNotBePartOfMemberRing = Seq(secondAddress), 30.seconds)
|
2012-05-28 11:06:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
runOn(second) {
|
2012-06-15 14:39:47 +02:00
|
|
|
enterBarrier("down-second-node")
|
2012-05-28 11:06:02 +02:00
|
|
|
}
|
|
|
|
|
|
2012-05-30 17:17:09 +02:00
|
|
|
runOn(third) {
|
2012-06-15 14:39:47 +02:00
|
|
|
enterBarrier("down-second-node")
|
2012-05-28 11:06:02 +02:00
|
|
|
|
|
|
|
|
awaitUpConvergence(numberOfMembers = 2, canNotBePartOfMemberRing = Seq(secondAddress), 30 seconds)
|
|
|
|
|
}
|
2012-06-05 14:13:44 +02:00
|
|
|
|
2012-06-15 14:39:47 +02:00
|
|
|
enterBarrier("await-completion-2")
|
2012-05-28 11:06:02 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|