aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/Response.java9
-rw-r--r--clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/PartitionStateRequest.java2
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateGeneratorTest.java41
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAutoTakedownTest.java19
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/StateRestApiTest.java3
-rw-r--r--vdslib/src/main/java/com/yahoo/vdslib/state/NodeState.java23
-rw-r--r--vdslib/src/test/java/com/yahoo/vdslib/state/ClusterStateTestCase.java18
-rw-r--r--vdslib/src/test/java/com/yahoo/vdslib/state/NodeStateTestCase.java40
8 files changed, 27 insertions, 128 deletions
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/Response.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/Response.java
index 90cbd80f18c..17949b82365 100644
--- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/Response.java
+++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/Response.java
@@ -6,7 +6,14 @@ import com.yahoo.vdslib.state.NodeState;
import com.yahoo.vdslib.state.State;
import com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.InternalFailure;
import com.yahoo.vespa.clustercontroller.utils.staterestapi.errors.StateRestApiException;
-import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.*;
+import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.CurrentUnitState;
+import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.DistributionState;
+import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.DistributionStates;
+import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.SubUnitList;
+import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitAttributes;
+import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitMetrics;
+import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitResponse;
+import com.yahoo.vespa.clustercontroller.utils.staterestapi.response.UnitState;
import java.util.LinkedHashMap;
import java.util.Map;
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/PartitionStateRequest.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/PartitionStateRequest.java
index b7bcca345e2..bb42af45ef3 100644
--- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/PartitionStateRequest.java
+++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/PartitionStateRequest.java
@@ -32,7 +32,7 @@ public class PartitionStateRequest extends Request<Response.PartitionResponse> {
fillInMetrics(context.cluster.getNodeInfo(id.getNode()).getHostInfo().getMetrics(), result);
}
NodeState nodeState = context.currentConsolidatedState.getNodeState(id.getNode());
- DiskState diskState = nodeState.getDiskState(id.getPartitionIndex());
+ DiskState diskState = new DiskState();
result.addState("generated", new Response.UnitStateImpl(diskState));
return result;
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateGeneratorTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateGeneratorTest.java
index 01b5cbb8e59..bf191768892 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateGeneratorTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateGeneratorTest.java
@@ -73,20 +73,6 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void storage_reported_disk_state_included_in_generated_state() {
- final NodeState stateWithDisks = new NodeState(NodeType.STORAGE, State.UP);
- stateWithDisks.setDiskCount(7);
- stateWithDisks.setDiskState(5, new DiskState(State.DOWN));
-
- final ClusterFixture fixture = ClusterFixture.forFlatCluster(9)
- .bringEntireClusterUp()
- .reportStorageNodeState(2, stateWithDisks);
- final AnnotatedClusterState state = generateFromFixtureWithDefaultParams(fixture);
-
- assertThat(state.toString(), equalTo("distributor:9 storage:9 .2.d:7 .2.d.5.s:d"));
- }
-
- @Test
public void worse_distributor_wanted_state_overrides_reported_state() {
// Maintenance mode is illegal for distributors and therefore not tested
final ClusterFixture fixture = ClusterFixture.forFlatCluster(7)
@@ -245,33 +231,6 @@ public class ClusterStateGeneratorTest {
}
@Test
- public void reported_disk_state_not_hidden_by_wanted_state() {
- final NodeState stateWithDisks = new NodeState(NodeType.STORAGE, State.UP);
- stateWithDisks.setDiskCount(5);
- stateWithDisks.setDiskState(3, new DiskState(State.DOWN));
-
- final ClusterFixture fixture = ClusterFixture.forFlatCluster(9)
- .bringEntireClusterUp()
- .reportStorageNodeState(2, stateWithDisks)
- .proposeStorageNodeWantedState(2, State.RETIRED)
- .reportStorageNodeState(3, stateWithDisks)
- .proposeStorageNodeWantedState(3, State.MAINTENANCE);
- final AnnotatedClusterState state = generateFromFixtureWithDefaultParams(fixture);
-
- // We do not publish disk states for nodes in Down state. This differs from how the
- // legacy controller did things, but such states cannot be counted on for ideal state
- // calculations either way. In particular, reported disk states are not persisted and
- // only exist transiently in the cluster controller's memory. A controller restart is
- // sufficient to clear all disk states that have been incidentally remembered for now
- // downed nodes.
- // The keen reader may choose to convince themselves of this independently by reading the
- // code in com.yahoo.vdslib.distribution.Distribution#getIdealStorageNodes and observing
- // how disk states for nodes that are in a down-state are never considered.
- assertThat(state.toString(), equalTo("distributor:9 storage:9 .2.s:r .2.d:5 .2.d.3.s:d " +
- ".3.s:m .3.d:5 .3.d.3.s:d"));
- }
-
- @Test
public void config_retired_mode_is_reflected_in_generated_state() {
ClusterFixture fixture = ClusterFixture.forFlatCluster(5)
.markNodeAsConfigRetired(2)
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAutoTakedownTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAutoTakedownTest.java
index a632ec62dc7..bd77f42ff8a 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAutoTakedownTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/GroupAutoTakedownTest.java
@@ -279,25 +279,6 @@ public class GroupAutoTakedownTest {
}
@Test
- public void disk_states_are_preserved_across_group_down_up_edge() {
- ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(
- DistributionBuilder.withGroups(3).eachWithNodeCount(2), 0.51);
-
- final NodeState newState = new NodeState(NodeType.STORAGE, State.UP);
- newState.setDiskCount(7);
- newState.setDiskState(5, new DiskState(State.DOWN));
-
- fixture.reportStorageNodeState(4, newState);
-
- assertEquals("distributor:6 storage:6 .4.d:7 .4.d.5.s:d", fixture.generatedClusterState());
-
- assertEquals("distributor:6 storage:4",
- stateAfterStorageTransition(fixture, 5, State.DOWN));
- assertEquals("distributor:6 storage:6 .4.d:7 .4.d.5.s:d",
- stateAfterStorageTransition(fixture, 5, State.UP));
- }
-
- @Test
public void down_wanted_state_is_preserved_across_group_down_up_edge() {
ClusterFixture fixture = createFixtureForAllUpHierarchicCluster(
DistributionBuilder.withGroups(3).eachWithNodeCount(3), 0.60);
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/StateRestApiTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/StateRestApiTest.java
index 1b900310d46..14eab503885 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/StateRestApiTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/restapiv2/StateRestApiTest.java
@@ -120,9 +120,6 @@ public abstract class StateRestApiTest {
for (ConfiguredNode configuredNode : nodes) {
for (NodeType type : NodeType.getTypes()) {
NodeState reported = new NodeState(type, State.UP);
- if (type.equals(NodeType.STORAGE)) {
- reported.setDiskCount(2);
- }
NodeInfo nodeInfo = cluster.clusterInfo().setRpcAddress(new Node(type, configuredNode.index()), "rpc:" + type + "/" + configuredNode);
nodeInfo.setReportedState(reported, 10);
diff --git a/vdslib/src/main/java/com/yahoo/vdslib/state/NodeState.java b/vdslib/src/main/java/com/yahoo/vdslib/state/NodeState.java
index e3b65c88f59..c6b3149639a 100644
--- a/vdslib/src/main/java/com/yahoo/vdslib/state/NodeState.java
+++ b/vdslib/src/main/java/com/yahoo/vdslib/state/NodeState.java
@@ -257,29 +257,6 @@ public class NodeState implements Cloneable {
return sb.toString();
}
- public NodeState setDiskCount(int count) {
- if (count < 0) {
- throw new IllegalArgumentException("Count must be positive. Was "+count+".");
- }
- diskStates.clear();
- for(int i=0;i<count;i++) {
- diskStates.add(new DiskState(State.UP, "", 1.0));
- }
- return this;
- }
-
- public NodeState setDiskState(int disk, DiskState state) throws IndexOutOfBoundsException {
- diskStates.set(disk, state);
- return this;
- }
-
- public DiskState getDiskState(int disk) throws IndexOutOfBoundsException {
- if (diskStates.isEmpty()) { // Zero disks, means unknown amount of disks, but all are up,
- return new DiskState(); // in which case we don't need to know amount of disks.
- }
- return diskStates.get(disk);
- }
-
public String serialize() { return serialize(-1, false); }
public String serialize(boolean verbose) { return serialize(-1, verbose); }
public String serialize(int nodeIdx, boolean verbose) {
diff --git a/vdslib/src/test/java/com/yahoo/vdslib/state/ClusterStateTestCase.java b/vdslib/src/test/java/com/yahoo/vdslib/state/ClusterStateTestCase.java
index cd0b1484748..258a79f5362 100644
--- a/vdslib/src/test/java/com/yahoo/vdslib/state/ClusterStateTestCase.java
+++ b/vdslib/src/test/java/com/yahoo/vdslib/state/ClusterStateTestCase.java
@@ -24,10 +24,10 @@ public class ClusterStateTestCase{
assertEquals("distributor:2 .0.s:d", state.toString());
state.setNodeState(new Node(NodeType.DISTRIBUTOR, 4), new NodeState(NodeType.DISTRIBUTOR, State.UP));
assertEquals("distributor:5 .0.s:d .2.s:d .3.s:d", state.toString());
- state.setNodeState(new Node(NodeType.STORAGE, 0), new NodeState(NodeType.STORAGE, State.UP).setDiskCount(4));
+ state.setNodeState(new Node(NodeType.STORAGE, 0), new NodeState(NodeType.STORAGE, State.UP));
assertEquals("distributor:5 .0.s:d .2.s:d .3.s:d storage:1", state.toString());
- state.setNodeState(new Node(NodeType.STORAGE, 0), new NodeState(NodeType.STORAGE, State.UP).setDiskCount(4).setDiskState(1, new DiskState(State.DOWN)));
- assertEquals("distributor:5 .0.s:d .2.s:d .3.s:d storage:1 .0.d:4 .0.d.1.s:d", state.toString());
+ state.setNodeState(new Node(NodeType.STORAGE, 0), new NodeState(NodeType.STORAGE, State.DOWN));
+ assertEquals("distributor:5 .0.s:d .2.s:d .3.s:d", state.toString());
}
@Test
@@ -35,7 +35,7 @@ public class ClusterStateTestCase{
ClusterState state = new ClusterState("");
state.setNodeState(new Node(NodeType.DISTRIBUTOR, 1), new NodeState(NodeType.DISTRIBUTOR, State.UP).setDescription("available"));
state.setNodeState(new Node(NodeType.STORAGE, 0), new NodeState(NodeType.STORAGE, State.UP).setCapacity(1.2f));
- state.setNodeState(new Node(NodeType.STORAGE, 2), new NodeState(NodeType.STORAGE, State.UP).setDiskCount(2).setDiskState(1, new DiskState(State.DOWN)));
+ state.setNodeState(new Node(NodeType.STORAGE, 2), new NodeState(NodeType.STORAGE, State.UP));
ClusterState other = state.clone();
assertEquals(state.toString(true), other.toString(true));
assertEquals(state.toString(false), other.toString(false));
@@ -187,10 +187,10 @@ public class ClusterStateTestCase{
state2.setDistributionBits(21);
state1.setVersion(123);
- state1.setNodeState(new Node(NodeType.STORAGE, 2), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.2f).setDiskCount(2).setDescription("Booting"));
+ state1.setNodeState(new Node(NodeType.STORAGE, 2), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.2f).setDescription("Booting"));
state2.setOfficial(true);
- assertEquals("version: 123 => 0, bits: 16 => 21, official: false => true, storage: [2: [Initializing => Up, disks: 2 => 0, description: Booting => ], 4: Down => Up, 5: Down => Up], distributor: [7: Up => Down, 8: Up => Down]", state1.getTextualDifference(state2));
+ assertEquals("version: 123 => 0, bits: 16 => 21, official: false => true, storage: [2: [Initializing => Up, description: Booting => ], 4: Down => Up, 5: Down => Up], distributor: [7: Up => Down, 8: Up => Down]", state1.getTextualDifference(state2));
}
@Test
@@ -219,12 +219,12 @@ public class ClusterStateTestCase{
"]", state2.getHtmlDifference(state3));
state1.setVersion(123);
- state1.setNodeState(new Node(NodeType.STORAGE, 2), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.2f).setDiskCount(2).setDescription("Booting"));
+ state1.setNodeState(new Node(NodeType.STORAGE, 2), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.2f).setDescription("Booting"));
state2.setDistributionBits(21);
state2.setOfficial(true);
- assertEquals("version: 123 => 0, bits: 16 => 21, official: false => true, storage: [2: [Initializing => Up, disks: 2 => 0, description: Booting => ], 4: Down => Up, 5: Down => Up], distributor: [7: Up => Down, 8: Up => Down]", state1.getTextualDifference(state2));
+ assertEquals("version: 123 => 0, bits: 16 => 21, official: false => true, storage: [2: [Initializing => Up, description: Booting => ], 4: Down => Up, 5: Down => Up], distributor: [7: Up => Down, 8: Up => Down]", state1.getTextualDifference(state2));
assertEquals("version: 123 =&gt; 0, bits: 16 =&gt; 21, official: false =&gt; true, storage: [<br>\n" +
- "&nbsp;2: [<b>Initializing</b> =&gt; <b>Up</b>, disks: 2 =&gt; 0, description: Booting =&gt; ], <br>\n" +
+ "&nbsp;2: [<b>Initializing</b> =&gt; <b>Up</b>, description: Booting =&gt; ], <br>\n" +
"&nbsp;4: <b>Down</b> =&gt; <b>Up</b>, <br>\n" +
"&nbsp;5: <b>Down</b> =&gt; <b>Up</b><br>\n" +
"], distributor: [<br>\n" +
diff --git a/vdslib/src/test/java/com/yahoo/vdslib/state/NodeStateTestCase.java b/vdslib/src/test/java/com/yahoo/vdslib/state/NodeStateTestCase.java
index f217e2fef4e..a6d9778cdd3 100644
--- a/vdslib/src/test/java/com/yahoo/vdslib/state/NodeStateTestCase.java
+++ b/vdslib/src/test/java/com/yahoo/vdslib/state/NodeStateTestCase.java
@@ -92,13 +92,12 @@ public class NodeStateTestCase {
assertEquals("m:Foo\\x20bar", ns.serialize(false));
assertEquals("m:Foo\\x20bar", ns.serialize(true));
- ns = new NodeState(NodeType.STORAGE, State.MAINTENANCE).setDescription("Foo bar").setCapacity(1.2f).setDiskCount(4)
- .setMinUsedBits(12).setStartTimestamp(5).setDiskState(1, new DiskState(State.DOWN, "bad disk", 1))
- .setDiskState(3, new DiskState(State.UP, "", 2));
- assertEquals(".2.s:m .2.c:1.2 .2.t:5 .2.d:4 .2.d.1.s:d .2.d.3.c:2.0", ns.serialize(2, false));
- assertEquals("s:m c:1.2 t:5 b:12 d:4 d.1.s:d d.3.c:2.0 m:Foo\\x20bar", ns.serialize(false));
- assertEquals("s:m c:1.2 t:5 b:12 d:4 d.1.s:d d.1.m:bad\\x20disk d.3.c:2.0 m:Foo\\x20bar", ns.serialize(true));
- NodeState ns2 = NodeState.deserialize(NodeType.STORAGE, "s:m c:1.2 t:5 b:12 d:4 d.1.s:d d.1.m:bad\\x20disk d.3.c:2.0 m:Foo\\x20bar");
+ ns = new NodeState(NodeType.STORAGE, State.MAINTENANCE).setDescription("Foo bar").setCapacity(1.2f)
+ .setMinUsedBits(12).setStartTimestamp(5);
+ assertEquals(".2.s:m .2.c:1.2 .2.t:5", ns.serialize(2, false));
+ assertEquals("s:m c:1.2 t:5 b:12 m:Foo\\x20bar", ns.serialize(false));
+ assertEquals("s:m c:1.2 t:5 b:12 m:Foo\\x20bar", ns.serialize(true));
+ NodeState ns2 = NodeState.deserialize(NodeType.STORAGE, "s:m c:1.2 t:5 b:12 m:Foo\\x20bar");
assertEquals(ns, ns2);
NodeState copy1 = NodeState.deserialize(NodeType.STORAGE, ns.serialize(false));
@@ -142,22 +141,6 @@ public class NodeStateTestCase {
assertTrue(ns1.similarToIgnoringInitProgress(ns2));
assertFalse(ns1.equals(ns2));
}
- {
- NodeState ns = new NodeState(NodeType.STORAGE, State.MAINTENANCE);
- NodeState ns2Disks = new NodeState(NodeType.STORAGE, State.MAINTENANCE).setDiskCount(2);
- assertEquals(ns, ns2Disks);
- assertEquals(ns2Disks, ns);
- assertTrue(ns.similarTo(ns2Disks));
- assertTrue(ns.similarToIgnoringInitProgress(ns2Disks));
- assertTrue(ns2Disks.similarTo(ns));
-
- ns2Disks.getDiskState(0).setState(State.DOWN);
- assertFalse(ns.equals(ns2Disks));
- assertFalse(ns2Disks.equals(ns));
- assertFalse(ns.similarTo(ns2Disks));
- assertFalse(ns.similarToIgnoringInitProgress(ns2Disks));
- assertFalse(ns2Disks.similarTo(ns));
- }
}
@Test
@@ -168,12 +151,11 @@ public class NodeStateTestCase {
String expected = "Maintenance => Up";
assertEquals(expected, ns.getTextualDifference(new NodeState(NodeType.STORAGE, State.UP)).substring(0, expected.length()));
- NodeState ns1 = new NodeState(NodeType.STORAGE, State.MAINTENANCE).setDescription("Foo bar").setCapacity(1.2f).setDiskCount(4)
- .setMinUsedBits(12).setStartTimestamp(5).setDiskState(1, new DiskState(State.DOWN, "bad disk", 1))
- .setDiskState(3, new DiskState(State.UP, "", 2));
+ NodeState ns1 = new NodeState(NodeType.STORAGE, State.MAINTENANCE).setDescription("Foo bar").setCapacity(1.2f)
+ .setMinUsedBits(12).setStartTimestamp(5);
ns1.toString();
ns1.toString(true);
- expected = "Maintenance => Up, capacity: 1.2 => 1.0, minUsedBits: 12 => 16, startTimestamp: 5 => 0, disks: 4 => 0, description: Foo bar => ";
+ expected = "Maintenance => Up, capacity: 1.2 => 1.0, minUsedBits: 12 => 16, startTimestamp: 5 => 0, description: Foo bar => ";
assertEquals(expected, ns1.getTextualDifference(new NodeState(NodeType.STORAGE, State.UP)).substring(0, expected.length()));
}
@@ -187,10 +169,6 @@ public class NodeStateTestCase {
new NodeState(NodeType.DISTRIBUTOR, State.UP).setCapacity(3).verifyValidInSystemState(NodeType.DISTRIBUTOR);
assertTrue("Should not be valid", false);
} catch (Exception e) {}
- try{
- new NodeState(NodeType.DISTRIBUTOR, State.UP).setDiskCount(2).verifyValidInSystemState(NodeType.DISTRIBUTOR);
- assertTrue("Should not be valid", false);
- } catch (Exception e) {}
}
}