summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeir Storli <geirst@oath.com>2018-02-16 13:25:07 +0100
committerGeir Storli <geirst@oath.com>2018-02-19 16:43:17 +0100
commit6744f7bcf76882700c6aebb25dccf17859399eb4 (patch)
tree4fe497eefcfe7add362c1b46bcb6425eb5ae411d
parentc2f334c0ad1e15035465f87b90c94f5dbdf295f2 (diff)
Rename StorageMergeStats -> ContentClusterStats.
-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.java (renamed from clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/StorageMergeStats.java)12
-rw-r--r--clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridge.java11
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateViewTest.java1
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsAggregatorTest.java26
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridgeTest.java4
6 files changed, 35 insertions, 39 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 849a2aa23c2..19f9b865444 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
@@ -40,18 +40,18 @@ public class ClusterStatsAggregator {
// Maps the distributor node index to a map of storage node index to the
// storage node's merge stats.
- private final Map<Integer, StorageMergeStats> distributorToStats = new HashMap<>();
+ private final Map<Integer, ContentClusterStats> distributorToStats = new HashMap<>();
- // This is only needed as an optimization. should just be the sum of distributorToStats' StorageMergeStats.
+ // This is only needed as an optimization. should just be the sum of distributorToStats' ContentClusterStats.
// Maps the storage node index to the aggregate merge stats for that storage node.
// This MUST be kept up-to-date with distributorToStats;
- private final StorageMergeStats aggregatedStats;
+ private final ContentClusterStats aggregatedStats;
private int hostToStatsMapHashCode = 0;
ClusterStatsAggregator(Set<Integer> distributors, Set<Integer> storageNodes, MetricUpdater updater) {
this.distributors = distributors;
- aggregatedStats = new StorageMergeStats(storageNodes);
+ aggregatedStats = new ContentClusterStats(storageNodes);
this.updater = updater;
}
@@ -59,12 +59,12 @@ public class ClusterStatsAggregator {
* Update the aggregator with the newest available stats from a distributor.
* Will update metrics if necessary.
*/
- void updateForDistributor(Map<Integer, String> hostnames, int distributorIndex, StorageMergeStats storageStats) {
+ void updateForDistributor(Map<Integer, String> hostnames, int distributorIndex, ContentClusterStats clusterStats) {
if (!distributors.contains(distributorIndex)) {
return;
}
- addStatsFromDistributor(distributorIndex, storageStats);
+ addStatsFromDistributor(distributorIndex, clusterStats);
if (distributorToStats.size() < distributors.size()) {
// Not all distributors have reported their merge stats through getnodestate yet.
@@ -101,19 +101,19 @@ public class ClusterStatsAggregator {
return hostToStatsMap;
}
- private void addStatsFromDistributor(int distributorIndex, StorageMergeStats storageStatsFromDistributor) {
- StorageMergeStats previousStorageStats = distributorToStats.put(distributorIndex, storageStatsFromDistributor);
+ private void addStatsFromDistributor(int distributorIndex, ContentClusterStats clusterStats) {
+ ContentClusterStats previousStorageStats = distributorToStats.put(distributorIndex, clusterStats);
for (NodeMergeStats storageNode : aggregatedStats) {
Integer storageNodeIndex = storageNode.getNodeIndex();
- NodeMergeStats statsToAdd = storageStatsFromDistributor.getStorageNode(storageNodeIndex);
+ NodeMergeStats statsToAdd = clusterStats.getStorageNode(storageNodeIndex);
if (statsToAdd != null) {
storageNode.add(statsToAdd);
}
if (previousStorageStats != null) {
- NodeMergeStats statsToSubtract = storageStatsFromDistributor.getStorageNode(storageNodeIndex);
+ NodeMergeStats statsToSubtract = clusterStats.getStorageNode(storageNodeIndex);
if (statsToSubtract != null) {
storageNode.subtract(statsToSubtract);
}
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/StorageMergeStats.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentClusterStats.java
index 6a44bee8cce..33ba51a0aba 100644
--- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/StorageMergeStats.java
+++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentClusterStats.java
@@ -7,23 +7,23 @@ import java.util.Map;
import java.util.Set;
/**
- * Class for storing the pending merge operation stats for all the storage nodes.
+ * Class for storing the pending merge operation stats for all the content nodes.
*
* @author hakonhall
*/
-public class StorageMergeStats implements Iterable<NodeMergeStats> {
+public class ContentClusterStats implements Iterable<NodeMergeStats> {
// Maps a storage node index to the storage node's pending merges stats.
private final Map<Integer, NodeMergeStats> mapToNodeStats;
- public StorageMergeStats(Set<Integer> storageNodes) {
+ public ContentClusterStats(Set<Integer> storageNodes) {
mapToNodeStats = new HashMap<>(storageNodes.size());
for (Integer index : storageNodes) {
mapToNodeStats.put(index, new NodeMergeStats(index));
}
}
- public StorageMergeStats(Map<Integer, NodeMergeStats> mapToNodeStats) {
+ public ContentClusterStats(Map<Integer, NodeMergeStats> mapToNodeStats) {
this.mapToNodeStats = mapToNodeStats;
}
@@ -43,11 +43,11 @@ public class StorageMergeStats implements Iterable<NodeMergeStats> {
@Override
public boolean equals(Object o) {
if (this == o) return true;
- if (!(o instanceof StorageMergeStats)) {
+ if (!(o instanceof ContentClusterStats)) {
return false;
}
- StorageMergeStats that = (StorageMergeStats) o;
+ ContentClusterStats that = (ContentClusterStats) o;
if (mapToNodeStats != null ? !mapToNodeStats.equals(that.mapToNodeStats) : that.mapToNodeStats != null) {
return false;
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 6d0da8a9fba..eda5c41c410 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
@@ -1,11 +1,8 @@
// 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.LatencyStats;
-import com.yahoo.vespa.clustercontroller.core.NodeMergeStats;
-import com.yahoo.vespa.clustercontroller.core.StorageMergeStats;
-import com.yahoo.vespa.clustercontroller.core.StorageNodeStats;
-import com.yahoo.vespa.clustercontroller.core.StorageNodeStatsContainer;
+import com.yahoo.vespa.clustercontroller.core.*;
+import com.yahoo.vespa.clustercontroller.core.ContentClusterStats;
import java.util.HashMap;
import java.util.List;
@@ -45,12 +42,12 @@ public class StorageNodeStatsBridge {
return container;
}
- public static StorageMergeStats generate(Distributor distributor) {
+ public static ContentClusterStats generate(Distributor distributor) {
Map<Integer, NodeMergeStats> mapToNodeStats = new HashMap<>();
for (StorageNode storageNode : distributor.getStorageNodes()) {
mapToNodeStats.put(storageNode.getIndex(), new NodeMergeStats(storageNode));
}
- return new StorageMergeStats(mapToNodeStats);
+ return new ContentClusterStats(mapToNodeStats);
}
}
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateViewTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateViewTest.java
index 3b04fec3e79..6487a55b554 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateViewTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateViewTest.java
@@ -22,7 +22,6 @@ public class ClusterStateViewTest {
final NodeInfo nodeInfo = mock(NodeInfo.class);
final Node node = mock(Node.class);
final ClusterStatsAggregator statsAggregator = mock(ClusterStatsAggregator.class);
- final StorageMergeStats storageStats = mock(StorageMergeStats.class);
final ClusterState clusterState = mock(ClusterState.class);
final MetricUpdater metricUpdater = mock(MetricUpdater.class);
final ClusterStateView clusterStateView = new ClusterStateView(clusterState, statsAggregator, metricUpdater);
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 eb4455b9492..9b8ac3c389d 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
@@ -24,7 +24,7 @@ public class ClusterStatsAggregatorTest {
final Set<Integer> storageNodes = new HashSet<>();
final Map<Integer, String> hostnames = new HashMap<>();
final MetricUpdater updater = mock(MetricUpdater.class);
- StorageMergeStats storageStats;
+ ContentClusterStats clusterStats;
private void addDistributors(Integer... indices) {
for (Integer i : indices) {
@@ -46,11 +46,11 @@ public class ClusterStatsAggregatorTest {
storageNodes.add(spec.index);
hostnames.put(spec.index, spec.hostname);
}
- storageStats = new StorageMergeStats(storageNodes);
+ clusterStats = new ContentClusterStats(storageNodes);
}
private void putStorageStats(int index, int syncing, int copyingIn, int movingOut, int copyingOut) {
- storageStats.getStorageNode(index).set(createStats(index, syncing, copyingIn, movingOut, copyingOut));
+ clusterStats.getStorageNode(index).set(createStats(index, syncing, copyingIn, movingOut, copyingOut));
}
private static NodeMergeStats createStats(int index, int syncing, int copyingIn, int movingOut, int copyingOut) {
@@ -73,7 +73,7 @@ public class ClusterStatsAggregatorTest {
putStorageStats(storageNodeIndex, 5, 6, 7, 8);
ClusterStatsAggregator aggregator = new ClusterStatsAggregator(distributors, storageNodes, updater);
- aggregator.updateForDistributor(hostnames, distributorIndex, storageStats);
+ aggregator.updateForDistributor(hostnames, distributorIndex, clusterStats);
Map<String, NodeMergeStats> expectedStorageNodeStats = new HashMap<>();
expectedStorageNodeStats.put("storage-node", createStats(storageNodeIndex, 5, 6, 7, 8));
@@ -98,12 +98,12 @@ public class ClusterStatsAggregatorTest {
// Distributor 1.
putStorageStats(storageNode1, 0, 1, 2, 3);
putStorageStats(storageNode2, 20, 21, 22, 23);
- aggregator.updateForDistributor(hostnames, distributor1, storageStats);
+ aggregator.updateForDistributor(hostnames, distributor1, clusterStats);
// Distributor 2.
putStorageStats(storageNode1, 10, 11, 12, 13);
putStorageStats(storageNode2, 30, 31, 32, 33);
- aggregator.updateForDistributor(hostnames, distributor2, storageStats);
+ 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));
@@ -129,16 +129,16 @@ public class ClusterStatsAggregatorTest {
// Distributor 1.
putStorageStats(storageNode1, 0, 1, 2, 3);
putStorageStats(storageNode2, 20, 21, 22, 23);
- aggregator.updateForDistributor(hostnames, distributor1, storageStats);
+ aggregator.updateForDistributor(hostnames, distributor1, clusterStats);
// Distributor 2.
putStorageStats(storageNode1, 10, 11, 12, 13);
putStorageStats(storageNode2, 30, 31, 32, 33);
- aggregator.updateForDistributor(hostnames, distributor2, storageStats);
+ aggregator.updateForDistributor(hostnames, distributor2, clusterStats);
// If we add call another updateForDistributor with the same arguments, updateMergeOpMetrics() should not be called.
// See times(1) below.
- aggregator.updateForDistributor(hostnames, distributor2, storageStats);
+ 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));
@@ -160,7 +160,7 @@ public class ClusterStatsAggregatorTest {
putStorageStats(storageNodeIndex, 5, 6, 7, 8);
ClusterStatsAggregator aggregator = new ClusterStatsAggregator(distributors, storageNodes, updater);
- aggregator.updateForDistributor(hostnames, DownDistributorIndex, storageStats);
+ aggregator.updateForDistributor(hostnames, DownDistributorIndex, clusterStats);
verify(updater, never()).updateMergeOpMetrics(any());
}
@@ -181,7 +181,7 @@ public class ClusterStatsAggregatorTest {
// Distributor 1.
putStorageStats(storageNode1, 0, 1, 2, 3);
putStorageStats(storageNode2, 20, 21, 22, 23);
- aggregator.updateForDistributor(hostnames, distributor1, storageStats);
+ aggregator.updateForDistributor(hostnames, distributor1, clusterStats);
Map<String, NodeMergeStats> expectedStorageNodeStats = new HashMap<>();
expectedStorageNodeStats.put("storage-node-1", createStats(storageNode1, 0, 1, 2, 3));
@@ -203,11 +203,11 @@ public class ClusterStatsAggregatorTest {
// Distributor 1.
putStorageStats(storageNode1, 0, 1, 2, 3);
- aggregator.updateForDistributor(hostnames, distributor1, storageStats);
+ aggregator.updateForDistributor(hostnames, distributor1, clusterStats);
// Distributor 2.
putStorageStats(storageNode1, 10, 11, 12, 13);
- aggregator.updateForDistributor(hostnames, distributor2, storageStats);
+ 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));
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 8a17fedee86..e335026a764 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
@@ -2,7 +2,7 @@
package com.yahoo.vespa.clustercontroller.core.hostinfo;
import com.yahoo.vespa.clustercontroller.core.NodeMergeStats;
-import com.yahoo.vespa.clustercontroller.core.StorageMergeStats;
+import com.yahoo.vespa.clustercontroller.core.ContentClusterStats;
import com.yahoo.vespa.clustercontroller.core.StorageNodeStats;
import com.yahoo.vespa.clustercontroller.core.StorageNodeStatsContainer;
import org.junit.Test;
@@ -53,7 +53,7 @@ public class StorageNodeStatsBridgeTest {
String data = getJsonString();
HostInfo hostInfo = HostInfo.createHostInfo(data);
- StorageMergeStats storageMergeStats = StorageNodeStatsBridge.generate(hostInfo.getDistributor());
+ ContentClusterStats storageMergeStats = StorageNodeStatsBridge.generate(hostInfo.getDistributor());
int size = 0;
for (NodeMergeStats mergeStats : storageMergeStats) {
assertThat(mergeStats.getCopyingIn().getBuckets(), is(2L));