summaryrefslogtreecommitdiffstats
path: root/vdslib
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@oath.com>2018-02-20 13:55:59 +0100
committerTor Brede Vekterli <vekterli@oath.com>2018-02-22 14:17:22 +0100
commit4cd6e2a3c02fe49409fa0a888af87e84ec93fa7a (patch)
tree8b90a25de4e201374c973a53f3e0329416447b53 /vdslib
parent49f310b5545eaac8aa8567f7d0a5b1944505e011 (diff)
Initial support for per bucket space cluster states in cluster controller
Multiple spaces are only enabled in tests, so the controller still only generates the legacy baseline cluster state, maintaining today's behavior.
Diffstat (limited to 'vdslib')
-rw-r--r--vdslib/src/main/java/com/yahoo/vdslib/state/ClusterState.java3
-rw-r--r--vdslib/src/main/java/com/yahoo/vdslib/state/Node.java8
2 files changed, 11 insertions, 0 deletions
diff --git a/vdslib/src/main/java/com/yahoo/vdslib/state/ClusterState.java b/vdslib/src/main/java/com/yahoo/vdslib/state/ClusterState.java
index a6ede3d4fec..9dab7e46a88 100644
--- a/vdslib/src/main/java/com/yahoo/vdslib/state/ClusterState.java
+++ b/vdslib/src/main/java/com/yahoo/vdslib/state/ClusterState.java
@@ -103,6 +103,9 @@ public class ClusterState implements Cloneable {
}
private boolean similarToImpl(final ClusterState other, final NodeStateCmp nodeStateCmp) {
+ if (other == this) {
+ return true; // We're definitely similar to ourselves.
+ }
// Two cluster states are considered similar if they are both down. When clusters
// are down, their individual node states do not matter to ideal state computations
// and content nodes therefore do not need to observe them.
diff --git a/vdslib/src/main/java/com/yahoo/vdslib/state/Node.java b/vdslib/src/main/java/com/yahoo/vdslib/state/Node.java
index 59af0b4eb84..89bdcc53748 100644
--- a/vdslib/src/main/java/com/yahoo/vdslib/state/Node.java
+++ b/vdslib/src/main/java/com/yahoo/vdslib/state/Node.java
@@ -21,6 +21,14 @@ public class Node implements Comparable<Node> {
index = Integer.valueOf(serialized.substring(dot + 1));
}
+ public static Node ofStorage(int index) {
+ return new Node(NodeType.STORAGE, index);
+ }
+
+ public static Node ofDistributor(int index) {
+ return new Node(NodeType.DISTRIBUTOR, index);
+ }
+
public String toString() {
return type.toString() + "." + index;
}