Merge pull request #23270 from akka/wip-revert-multi-dc-master-patriknw

Revert cluster team setting
This commit is contained in:
Patrik Nordwall 2017-07-04 09:13:37 +02:00 committed by GitHub
commit e6c2d3f550
9 changed files with 5 additions and 54 deletions

View file

@ -65,11 +65,6 @@ akka {
# move 'WeaklyUp' members to 'Up' status once convergence has been reached.
allow-weakly-up-members = on
# Teams are used to make islands of the cluster that are colocated. This can be used
# to make the cluster aware that it is running across multiple availability zones or regions.
# The team is added to the list of roles of the node with the prefix "team-".
team = "default"
# 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
# routers or other services to distribute work to certain member types,

View file

@ -154,7 +154,7 @@ private[akka] class ClusterJmx(cluster: Cluster, log: LoggingAdapter) {
val members = clusterView.members.toSeq.sorted(Member.ordering).map { m
s"""{
| "address": "${m.address}",
| "roles": [${if (m.roles.isEmpty) "" else m.roles.toList.sorted.map("\"" + _ + "\"").mkString("\n ", ",\n ", "\n ")}],
| "roles": [${if (m.roles.isEmpty) "" else m.roles.map("\"" + _ + "\"").mkString("\n ", ",\n ", "\n ")}],
| "status": "${m.status}"
| }""".stripMargin
} mkString (",\n ")

View file

@ -93,8 +93,7 @@ final class ClusterSettings(val config: Config, val systemName: String) {
val AllowWeaklyUpMembers = cc.getBoolean("allow-weakly-up-members")
val Team: String = cc.getString("team")
val Roles: Set[String] = immutableSeq(cc.getStringList("roles")).toSet + s"team-$Team"
val Roles: Set[String] = immutableSeq(cc.getStringList("roles")).toSet
val MinNrOfMembers: Int = {
cc.getInt("min-nr-of-members")
} requiring (_ > 0, "min-nr-of-members must be > 0")

View file

@ -22,9 +22,6 @@ class Member private[cluster] (
val status: MemberStatus,
val roles: Set[String]) extends Serializable {
lazy val team: String = roles.find(_.startsWith("team-"))
.getOrElse(throw new IllegalStateException("Team undefined, should not be possible"))
def address: Address = uniqueAddress.address
override def hashCode = uniqueAddress.##

View file

@ -120,7 +120,6 @@ abstract class MBeanSpec
| {
| "address": "${sortedNodes(0)}",
| "roles": [
| "team-default",
| "testNode"
| ],
| "status": "Up"
@ -128,7 +127,6 @@ abstract class MBeanSpec
| {
| "address": "${sortedNodes(1)}",
| "roles": [
| "team-default",
| "testNode"
| ],
| "status": "Up"
@ -136,7 +134,6 @@ abstract class MBeanSpec
| {
| "address": "${sortedNodes(2)}",
| "roles": [
| "team-default",
| "testNode"
| ],
| "status": "Up"
@ -144,7 +141,6 @@ abstract class MBeanSpec
| {
| "address": "${sortedNodes(3)}",
| "roles": [
| "team-default",
| "testNode"
| ],
| "status": "Up"

View file

@ -91,7 +91,7 @@ abstract class QuickRestartSpec
Cluster(system).state.members.size should ===(totalNumberOfNodes)
Cluster(system).state.members.map(_.status == MemberStatus.Up)
// use the role to test that it is the new incarnation that joined, sneaky
Cluster(system).state.members.flatMap(_.roles) should ===(Set(s"round-$n", "team-default"))
Cluster(system).state.members.flatMap(_.roles) should ===(Set(s"round-$n"))
}
}
enterBarrier("members-up-" + n)

View file

@ -5,13 +5,9 @@
package akka.cluster
import language.postfixOps
import scala.concurrent.duration._
import com.typesafe.config.ConfigFactory
import akka.testkit.AkkaSpec
import akka.dispatch.Dispatchers
import scala.concurrent.duration._
import akka.remote.PhiAccrualFailureDetector
import akka.util.Helpers.ConfigOps
import akka.actor.Address
@ -45,8 +41,7 @@ class ClusterConfigSpec extends AkkaSpec {
DownRemovalMargin should ===(Duration.Zero)
MinNrOfMembers should ===(1)
MinNrOfMembersOfRole should ===(Map.empty[String, Int])
Team should ===("default")
Roles should ===(Set("team-default"))
Roles should ===(Set.empty[String])
JmxEnabled should ===(true)
UseDispatcher should ===(Dispatchers.DefaultDispatcherId)
GossipDifferentViewProbability should ===(0.8 +- 0.0001)
@ -54,20 +49,5 @@ class ClusterConfigSpec extends AkkaSpec {
SchedulerTickDuration should ===(33 millis)
SchedulerTicksPerWheel should ===(512)
}
"be able to parse non-default cluster config elements" in {
val settings = new ClusterSettings(ConfigFactory.parseString(
"""
|akka {
| cluster {
| roles = [ "hamlet" ]
| team = "blue"
| }
|}
""".stripMargin).withFallback(ConfigFactory.load()), system.name)
import settings._
Roles should ===(Set("hamlet", "team-blue"))
Team should ===("blue")
}
}
}

View file

@ -1 +0,0 @@
../scala/cluster-team.md

View file

@ -1,15 +0,0 @@
# Cluster Team
@@@ note
Cluster teams are a work-in-progress feature, and behavior is still expected to change.
@@@
Teams are used to make islands of the cluster that are colocated. This can be used
to make the cluster aware that it is running across multiple availability zones or regions.
Cluster nodes can be assigned to a team by setting the `akka.cluster.team` setting.
When no team is specified, a node will belong to the 'default' team.
The team is added to the list of roles of the node with the prefix "team-".