summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeir Storli <geirst@oath.com>2018-02-16 13:36:49 +0100
committerGeir Storli <geirst@oath.com>2018-02-19 16:43:17 +0100
commit077656a019587ea4951a0f4ec156b8bee04e7385 (patch)
tree5bfb49ec22e8fc3db7c3c9f59bc555cc69b7dc1e
parent6744f7bcf76882700c6aebb25dccf17859399eb4 (diff)
Rename NodeMergeStats -> ContentNodeStats.
-rw-r--r--clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregator.java20
-rw-r--r--clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentClusterStats.java12
-rw-r--r--clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentNodeStats.java (renamed from clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/NodeMergeStats.java)20
-rw-r--r--clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/MetricUpdater.java2
-rw-r--r--clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridge.java4
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregatorTest.java48
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridgeTest.java14
7 files changed, 60 insertions, 60 deletions
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregator.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregator.java
index 19f9b865444..e1e626a7a71 100644
--- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregator.java
+++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregator.java
@@ -71,7 +71,7 @@ public class ClusterStatsAggregator {
return;
}
- Map<String, NodeMergeStats> hostToStatsMap = getHostToStatsMap(hostnames);
+ Map<String, ContentNodeStats> hostToStatsMap = getHostToStatsMap(hostnames);
if (hostToStatsMap == null) {
return;
}
@@ -82,9 +82,9 @@ public class ClusterStatsAggregator {
}
}
- private Map<String, NodeMergeStats> getHostToStatsMap(Map<Integer, String> hostnames) {
- Map<String, NodeMergeStats> hostToStatsMap = new HashMap<>(aggregatedStats.size());
- for (NodeMergeStats nodeStats : aggregatedStats) {
+ private Map<String, ContentNodeStats> getHostToStatsMap(Map<Integer, String> hostnames) {
+ Map<String, ContentNodeStats> hostToStatsMap = new HashMap<>(aggregatedStats.size());
+ for (ContentNodeStats nodeStats : aggregatedStats) {
// The hosts names are kept up-to-date from Slobrok, and MAY therefore be arbitrarily
// different from the node set used by aggregatedStats (and typically tied to a cluster state).
// If so, we will not pretend the returned map is complete, and will return null.
@@ -104,18 +104,18 @@ public class ClusterStatsAggregator {
private void addStatsFromDistributor(int distributorIndex, ContentClusterStats clusterStats) {
ContentClusterStats previousStorageStats = distributorToStats.put(distributorIndex, clusterStats);
- for (NodeMergeStats storageNode : aggregatedStats) {
- Integer storageNodeIndex = storageNode.getNodeIndex();
+ for (ContentNodeStats contentNode : aggregatedStats) {
+ Integer nodeIndex = contentNode.getNodeIndex();
- NodeMergeStats statsToAdd = clusterStats.getStorageNode(storageNodeIndex);
+ ContentNodeStats statsToAdd = clusterStats.getStorageNode(nodeIndex);
if (statsToAdd != null) {
- storageNode.add(statsToAdd);
+ contentNode.add(statsToAdd);
}
if (previousStorageStats != null) {
- NodeMergeStats statsToSubtract = clusterStats.getStorageNode(storageNodeIndex);
+ ContentNodeStats statsToSubtract = clusterStats.getStorageNode(nodeIndex);
if (statsToSubtract != null) {
- storageNode.subtract(statsToSubtract);
+ contentNode.subtract(statsToSubtract);
}
}
}
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentClusterStats.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentClusterStats.java
index 33ba51a0aba..154113b95c0 100644
--- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentClusterStats.java
+++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentClusterStats.java
@@ -11,28 +11,28 @@ import java.util.Set;
*
* @author hakonhall
*/
-public class ContentClusterStats implements Iterable<NodeMergeStats> {
+public class ContentClusterStats implements Iterable<ContentNodeStats> {
// Maps a storage node index to the storage node's pending merges stats.
- private final Map<Integer, NodeMergeStats> mapToNodeStats;
+ private final Map<Integer, ContentNodeStats> mapToNodeStats;
public ContentClusterStats(Set<Integer> storageNodes) {
mapToNodeStats = new HashMap<>(storageNodes.size());
for (Integer index : storageNodes) {
- mapToNodeStats.put(index, new NodeMergeStats(index));
+ mapToNodeStats.put(index, new ContentNodeStats(index));
}
}
- public ContentClusterStats(Map<Integer, NodeMergeStats> mapToNodeStats) {
+ public ContentClusterStats(Map<Integer, ContentNodeStats> mapToNodeStats) {
this.mapToNodeStats = mapToNodeStats;
}
@Override
- public Iterator<NodeMergeStats> iterator() {
+ public Iterator<ContentNodeStats> iterator() {
return mapToNodeStats.values().iterator();
}
- NodeMergeStats getStorageNode(Integer index) {
+ ContentNodeStats getStorageNode(Integer index) {
return mapToNodeStats.get(index);
}
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/NodeMergeStats.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentNodeStats.java
index 97112e01aed..11e05a74cf7 100644
--- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/NodeMergeStats.java
+++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentNodeStats.java
@@ -6,12 +6,12 @@ import com.yahoo.vespa.clustercontroller.core.hostinfo.StorageNode;
/**
* @author hakonhall
*/
-public class NodeMergeStats {
+public class ContentNodeStats {
/**
* Constructor that sets values to zero if not present.
*/
- public NodeMergeStats(StorageNode storageNodePojo) {
+ public ContentNodeStats(StorageNode storageNodePojo) {
this.nodeIndex = storageNodePojo.getIndex();
StorageNode.OutstandingMergeOps mergeOps = storageNodePojo.getOutstandingMergeOpsOrNull();
@@ -78,11 +78,11 @@ public class NodeMergeStats {
/**
* An instance with all 0 amounts.
*/
- public NodeMergeStats(int index) {
+ public ContentNodeStats(int index) {
this(index, new Amount(), new Amount(), new Amount(), new Amount());
}
- NodeMergeStats(int index, Amount syncing, Amount copyingIn, Amount movingOut, Amount copyingOut) {
+ ContentNodeStats(int index, Amount syncing, Amount copyingIn, Amount movingOut, Amount copyingOut) {
this.nodeIndex = index;
this.syncing = syncing;
this.copyingIn = copyingIn;
@@ -90,7 +90,7 @@ public class NodeMergeStats {
this.copyingOut = copyingOut;
}
- public void set(NodeMergeStats stats) {
+ public void set(ContentNodeStats stats) {
nodeIndex = stats.nodeIndex;
syncing.set(stats.syncing);
copyingIn.set(stats.copyingIn);
@@ -104,18 +104,18 @@ public class NodeMergeStats {
public Amount getMovingOut() { return movingOut; }
public Amount getCopyingOut() { return copyingOut; }
- void add(NodeMergeStats stats) {
+ void add(ContentNodeStats stats) {
scaledAdd(1, stats);
}
- void subtract(NodeMergeStats stats) {
+ void subtract(ContentNodeStats stats) {
scaledAdd(-1, stats);
}
/**
* Logically, adds (factor * stats) to this object. factor of 1 is normal add, -1 is subtraction.
*/
- private void scaledAdd(int factor, NodeMergeStats stats) {
+ private void scaledAdd(int factor, ContentNodeStats stats) {
syncing.scaledAdd(factor, stats.syncing);
copyingIn.scaledAdd(factor, stats.copyingIn);
movingOut.scaledAdd(factor, stats.movingOut);
@@ -132,11 +132,11 @@ public class NodeMergeStats {
@Override
public boolean equals(Object other) {
- if (!(other instanceof NodeMergeStats)) {
+ if (!(other instanceof ContentNodeStats)) {
return false;
}
- NodeMergeStats otherStats = (NodeMergeStats) other;
+ ContentNodeStats otherStats = (ContentNodeStats) other;
return nodeIndex == otherStats.nodeIndex &&
syncing.equals(otherStats.syncing) &&
copyingIn.equals(otherStats.copyingIn) &&
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/MetricUpdater.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/MetricUpdater.java
index b3b10e1d0d8..7c921be958b 100644
--- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/MetricUpdater.java
+++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/MetricUpdater.java
@@ -85,7 +85,7 @@ public class MetricUpdater {
metricReporter.add("node-event", 1);
}
- public void updateMergeOpMetrics(Map<String, NodeMergeStats> storageNodeStats) {
+ public void updateMergeOpMetrics(Map<String, ContentNodeStats> contentNodeStats) {
// TODO(hakonhall): Remove this method once we figure out how to propagate metrics to state HTTP API.
}
}
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridge.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridge.java
index eda5c41c410..1e595839fa2 100644
--- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridge.java
+++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridge.java
@@ -43,9 +43,9 @@ public class StorageNodeStatsBridge {
}
public static ContentClusterStats generate(Distributor distributor) {
- Map<Integer, NodeMergeStats> mapToNodeStats = new HashMap<>();
+ Map<Integer, ContentNodeStats> mapToNodeStats = new HashMap<>();
for (StorageNode storageNode : distributor.getStorageNodes()) {
- mapToNodeStats.put(storageNode.getIndex(), new NodeMergeStats(storageNode));
+ mapToNodeStats.put(storageNode.getIndex(), new ContentNodeStats(storageNode));
}
return new ContentClusterStats(mapToNodeStats);
}
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregatorTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregatorTest.java
index 9b8ac3c389d..e5bda010faf 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregatorTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregatorTest.java
@@ -53,13 +53,13 @@ public class ClusterStatsAggregatorTest {
clusterStats.getStorageNode(index).set(createStats(index, syncing, copyingIn, movingOut, copyingOut));
}
- private static NodeMergeStats createStats(int index, int syncing, int copyingIn, int movingOut, int copyingOut) {
- return new NodeMergeStats(
+ private static ContentNodeStats createStats(int index, int syncing, int copyingIn, int movingOut, int copyingOut) {
+ return new ContentNodeStats(
index,
- new NodeMergeStats.Amount(syncing),
- new NodeMergeStats.Amount(copyingIn),
- new NodeMergeStats.Amount(movingOut),
- new NodeMergeStats.Amount(copyingOut));
+ new ContentNodeStats.Amount(syncing),
+ new ContentNodeStats.Amount(copyingIn),
+ new ContentNodeStats.Amount(movingOut),
+ new ContentNodeStats.Amount(copyingOut));
}
@Test
@@ -75,10 +75,10 @@ public class ClusterStatsAggregatorTest {
ClusterStatsAggregator aggregator = new ClusterStatsAggregator(distributors, storageNodes, updater);
aggregator.updateForDistributor(hostnames, distributorIndex, clusterStats);
- Map<String, NodeMergeStats> expectedStorageNodeStats = new HashMap<>();
- expectedStorageNodeStats.put("storage-node", createStats(storageNodeIndex, 5, 6, 7, 8));
+ Map<String, ContentNodeStats> expectedContentNodeStats = new HashMap<>();
+ expectedContentNodeStats.put("storage-node", createStats(storageNodeIndex, 5, 6, 7, 8));
- verify(updater).updateMergeOpMetrics(expectedStorageNodeStats);
+ verify(updater).updateMergeOpMetrics(expectedContentNodeStats);
}
@Test
@@ -105,11 +105,11 @@ public class ClusterStatsAggregatorTest {
putStorageStats(storageNode2, 30, 31, 32, 33);
aggregator.updateForDistributor(hostnames, distributor2, clusterStats);
- Map<String, NodeMergeStats> expectedStorageNodeStats = new HashMap<>();
- expectedStorageNodeStats.put("storage-node-1", createStats(storageNode1, 0 + 10, 1 + 11, 2 + 12, 3 + 13));
- expectedStorageNodeStats.put("storage-node-2", createStats(storageNode2, 20 + 30, 21 + 31, 22 + 32, 23 + 33));
+ Map<String, ContentNodeStats> expectedContentNodeStats = new HashMap<>();
+ expectedContentNodeStats.put("storage-node-1", createStats(storageNode1, 0 + 10, 1 + 11, 2 + 12, 3 + 13));
+ expectedContentNodeStats.put("storage-node-2", createStats(storageNode2, 20 + 30, 21 + 31, 22 + 32, 23 + 33));
- verify(updater, times(1)).updateMergeOpMetrics(expectedStorageNodeStats);
+ verify(updater, times(1)).updateMergeOpMetrics(expectedContentNodeStats);
}
@Test
@@ -140,12 +140,12 @@ public class ClusterStatsAggregatorTest {
// See times(1) below.
aggregator.updateForDistributor(hostnames, distributor2, clusterStats);
- Map<String, NodeMergeStats> expectedStorageNodeStats = new HashMap<>();
- expectedStorageNodeStats.put("storage-node-1", createStats(storageNode1, 0 + 10, 1 + 11, 2 + 12, 3 + 13));
- expectedStorageNodeStats.put("storage-node-2", createStats(storageNode2, 20 + 30, 21 + 31, 22 + 32, 23 + 33));
+ Map<String, ContentNodeStats> expectedContentNodeStats = new HashMap<>();
+ expectedContentNodeStats.put("storage-node-1", createStats(storageNode1, 0 + 10, 1 + 11, 2 + 12, 3 + 13));
+ expectedContentNodeStats.put("storage-node-2", createStats(storageNode2, 20 + 30, 21 + 31, 22 + 32, 23 + 33));
- verify(updater, times(1)).updateMergeOpMetrics(expectedStorageNodeStats);
+ verify(updater, times(1)).updateMergeOpMetrics(expectedContentNodeStats);
}
@Test
@@ -183,11 +183,11 @@ public class ClusterStatsAggregatorTest {
putStorageStats(storageNode2, 20, 21, 22, 23);
aggregator.updateForDistributor(hostnames, distributor1, clusterStats);
- Map<String, NodeMergeStats> expectedStorageNodeStats = new HashMap<>();
- expectedStorageNodeStats.put("storage-node-1", createStats(storageNode1, 0, 1, 2, 3));
- expectedStorageNodeStats.put("storage-node-2", createStats(storageNode2, 20, 21, 22, 23));
+ Map<String, ContentNodeStats> expectedContentNodeStats = new HashMap<>();
+ expectedContentNodeStats.put("storage-node-1", createStats(storageNode1, 0, 1, 2, 3));
+ expectedContentNodeStats.put("storage-node-2", createStats(storageNode2, 20, 21, 22, 23));
- verify(updater, times(1)).updateMergeOpMetrics(expectedStorageNodeStats);
+ verify(updater, times(1)).updateMergeOpMetrics(expectedContentNodeStats);
}
@Test
@@ -209,9 +209,9 @@ public class ClusterStatsAggregatorTest {
putStorageStats(storageNode1, 10, 11, 12, 13);
aggregator.updateForDistributor(hostnames, distributor2, clusterStats);
- Map<String, NodeMergeStats> expectedStorageNodeStats = new HashMap<>();
- expectedStorageNodeStats.put("storage-node-1", createStats(storageNode1, 0 + 10, 1 + 11, 2 + 12, 3 + 13));
+ Map<String, ContentNodeStats> expectedContentNodeStats = new HashMap<>();
+ expectedContentNodeStats.put("storage-node-1", createStats(storageNode1, 0 + 10, 1 + 11, 2 + 12, 3 + 13));
- verify(updater, times(1)).updateMergeOpMetrics(expectedStorageNodeStats);
+ verify(updater, times(1)).updateMergeOpMetrics(expectedContentNodeStats);
}
}
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridgeTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridgeTest.java
index e335026a764..c9ce54ae3be 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridgeTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridgeTest.java
@@ -1,7 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.core.hostinfo;
-import com.yahoo.vespa.clustercontroller.core.NodeMergeStats;
+import com.yahoo.vespa.clustercontroller.core.ContentNodeStats;
import com.yahoo.vespa.clustercontroller.core.ContentClusterStats;
import com.yahoo.vespa.clustercontroller.core.StorageNodeStats;
import com.yahoo.vespa.clustercontroller.core.StorageNodeStatsContainer;
@@ -53,13 +53,13 @@ public class StorageNodeStatsBridgeTest {
String data = getJsonString();
HostInfo hostInfo = HostInfo.createHostInfo(data);
- ContentClusterStats storageMergeStats = StorageNodeStatsBridge.generate(hostInfo.getDistributor());
+ ContentClusterStats clusterStats = StorageNodeStatsBridge.generate(hostInfo.getDistributor());
int size = 0;
- for (NodeMergeStats mergeStats : storageMergeStats) {
- assertThat(mergeStats.getCopyingIn().getBuckets(), is(2L));
- assertThat(mergeStats.getCopyingOut().getBuckets(), is(4L));
- assertThat(mergeStats.getSyncing().getBuckets(), is(1L));
- assertThat(mergeStats.getMovingOut().getBuckets(), is(3L));
+ for (ContentNodeStats nodeStats : clusterStats) {
+ assertThat(nodeStats.getCopyingIn().getBuckets(), is(2L));
+ assertThat(nodeStats.getCopyingOut().getBuckets(), is(4L));
+ assertThat(nodeStats.getSyncing().getBuckets(), is(1L));
+ assertThat(nodeStats.getMovingOut().getBuckets(), is(3L));
size++;
}
assertThat(size, is(2));