summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeir Storli <geirst@oath.com>2018-02-27 14:41:29 +0100
committerGeir Storli <geirst@oath.com>2018-02-27 14:41:29 +0100
commitd7e5485a2b58c2ce6355766c588d0b16fe80fcb8 (patch)
treec6efc0cd864a871f0ba9214a0df42b390d182b88
parentf501d44bb86ffb4c09b2d46d3809e3c869ec7041 (diff)
Rename ClusterStatsBucketsPendingState -> ClusterStateChangeTracker.
-rw-r--r--clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStateChangeTracker.java (renamed from clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsBucketsPendingState.java)8
-rw-r--r--clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/StateVersionTracker.java11
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateChangeTrackerTest.java (renamed from clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsBucketsPendingStateTest.java)6
3 files changed, 12 insertions, 13 deletions
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsBucketsPendingState.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStateChangeTracker.java
index dfa64d72521..839d9c7357f 100644
--- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsBucketsPendingState.java
+++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ClusterStateChangeTracker.java
@@ -2,17 +2,17 @@
package com.yahoo.vespa.clustercontroller.core;
/**
- * Class tracking whether we have changes in buckets pending state in the 'global' bucket space.
+ * Class tracking whether we have changes in current and previous cluster stats.
*
- * The state is considered changed if the previous and current cluster stats differs in whether
+ * The state is considered changed if the current and previous cluster stats differs in whether
* they may have buckets pending in the 'global' bucket space. This signals that the ClusterStateBundle should be recomputed.
*/
-public class ClusterStatsBucketsPendingState {
+public class ClusterStateChangeTracker {
private ClusterStatsAggregator aggregator;
private boolean prevMayHaveBucketsPending;
- public ClusterStatsBucketsPendingState(ClusterStatsAggregator aggregator) {
+ public ClusterStateChangeTracker(ClusterStatsAggregator aggregator) {
this.aggregator = aggregator;
this.prevMayHaveBucketsPending = false;
}
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/StateVersionTracker.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/StateVersionTracker.java
index c2be8047a13..511f1707389 100644
--- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/StateVersionTracker.java
+++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/StateVersionTracker.java
@@ -7,7 +7,6 @@ import com.yahoo.vespa.clustercontroller.core.hostinfo.HostInfo;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
-import java.util.Map;
/**
* Keeps track of the active cluster state and handles the transition edges between
@@ -33,14 +32,14 @@ public class StateVersionTracker {
private ClusterStateBundle currentClusterState = latestCandidateState;
private ClusterStateView clusterStateView;
- private ClusterStatsBucketsPendingState bucketsPendingState;
+ private ClusterStateChangeTracker clusterStateChangeTracker;
private final LinkedList<ClusterStateHistoryEntry> clusterStateHistory = new LinkedList<>();
private int maxHistoryEntryCount = 50;
StateVersionTracker() {
clusterStateView = ClusterStateView.create(currentUnversionedState.getBaselineClusterState());
- bucketsPendingState = new ClusterStatsBucketsPendingState(clusterStateView.getStatsAggregator());
+ clusterStateChangeTracker = new ClusterStateChangeTracker(clusterStateView.getStatsAggregator());
}
void setVersionRetrievedFromZooKeeper(final int version) {
@@ -86,7 +85,7 @@ public class StateVersionTracker {
public void updateLatestCandidateStateBundle(final ClusterStateBundle candidateBundle) {
assert(latestCandidateState.getBaselineClusterState().getVersion() == 0);
latestCandidateState = candidateBundle;
- bucketsPendingState.syncBucketsPendingFlag();
+ clusterStateChangeTracker.syncBucketsPendingFlag();
}
/**
@@ -125,7 +124,7 @@ public class StateVersionTracker {
newStateBundle.getBaselineClusterState().getDistributionBitCount());
// TODO should this take place in updateLatestCandidateStateBundle instead? I.e. does it require a consolidated state?
clusterStateView = ClusterStateView.create(currentClusterState.getBaselineClusterState());
- bucketsPendingState.updateAggregator(clusterStateView.getStatsAggregator());
+ clusterStateChangeTracker.updateAggregator(clusterStateView.getStatsAggregator());
}
private void recordCurrentStateInHistoryAtTime(final long currentTimeMs) {
@@ -142,7 +141,7 @@ public class StateVersionTracker {
}
boolean bucketSpaceMergeCompletionStateHasChanged() {
- return bucketsPendingState.stateHasChanged();
+ return clusterStateChangeTracker.stateHasChanged();
}
/*
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsBucketsPendingStateTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateChangeTrackerTest.java
index d785225d64d..b15ba035fe1 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStatsBucketsPendingStateTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/ClusterStateChangeTrackerTest.java
@@ -7,15 +7,15 @@ import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-public class ClusterStatsBucketsPendingStateTest {
+public class ClusterStateChangeTrackerTest {
private static class Fixture {
private ClusterStatsAggregator aggregator;
- private ClusterStatsBucketsPendingState state;
+ private ClusterStateChangeTracker state;
public Fixture() {
aggregator = new ClusterStatsAggregator(Sets.newHashSet(1), Sets.newHashSet(2));
- state = new ClusterStatsBucketsPendingState(aggregator);
+ state = new ClusterStateChangeTracker(aggregator);
}
public void setBucketsPendingStats() {