summaryrefslogtreecommitdiffstats
path: root/clustercontroller-core/src/test
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@verizonmedia.com>2021-03-11 17:41:14 +0100
committerTor Brede Vekterli <vekterli@verizonmedia.com>2021-03-12 14:40:35 +0100
commit0a78220415f590da91e4710d38c52c42a0f7572c (patch)
treec9e1a0aa1806c3fb62d2cbbf14a2a9fdcfec1056 /clustercontroller-core/src/test
parentcdf52990f001826004b52b39acf99647c7f7b0f7 (diff)
Don't store full bundle objects in cluster state history
Bundles have a lot of sub-objects per state, so in systems with a high amount of node entries, this adds unnecessary pressure on the heap. Instead, store the string representations of the bundle and the string representation of the diff to the previous state version (if any). This is also inherently faster than computing the diffs on-demand on every status page render. Also remove mutable `official` field from `ClusterState`. Not worth violating immutability of an object just to get some prettier (but with high likelihood actually more confusing) status page rendering.
Diffstat (limited to 'clustercontroller-core/src/test')
-rw-r--r--clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateVersionTrackerTest.java32
1 files changed, 23 insertions, 9 deletions
diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateVersionTrackerTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateVersionTrackerTest.java
index 83bdbfa0213..496d2a3b29a 100644
--- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateVersionTrackerTest.java
+++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateVersionTrackerTest.java
@@ -180,8 +180,13 @@ public class StateVersionTrackerTest {
assertTrue(versionTracker.getClusterStateHistory().isEmpty());
}
- private static ClusterStateHistoryEntry historyEntry(final String state, final long time) {
- return new ClusterStateHistoryEntry(stateBundleWithoutAnnotations(state), time);
+ private static ClusterStateHistoryEntry historyEntry(String state, long time) {
+ return ClusterStateHistoryEntry.makeFirstEntry(stateBundleWithoutAnnotations(state), time);
+ }
+
+ private static ClusterStateHistoryEntry historyEntry(String state, String prevState, long time) {
+ return ClusterStateHistoryEntry.makeSuccessor(stateBundleWithoutAnnotations(state),
+ stateBundleWithoutAnnotations(prevState), time);
}
@Test
@@ -191,12 +196,16 @@ public class StateVersionTrackerTest {
updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:3 storage:3"), 200);
updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:4 storage:4"), 300);
+ String s4 = "version:4 distributor:4 storage:4";
+ String s3 = "version:3 distributor:3 storage:3";
+ String s2 = "version:2 distributor:2 storage:2";
+
// Note: newest entry first
assertThat(versionTracker.getClusterStateHistory(),
equalTo(Arrays.asList(
- historyEntry("version:4 distributor:4 storage:4", 300),
- historyEntry("version:3 distributor:3 storage:3", 200),
- historyEntry("version:2 distributor:2 storage:2", 100))));
+ historyEntry(s4, s3, 300),
+ historyEntry(s3, s2, 200),
+ historyEntry(s2, 100))));
}
@Test
@@ -208,17 +217,22 @@ public class StateVersionTrackerTest {
updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:3 storage:3"), 200);
updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:4 storage:4"), 300);
+ String s5 = "version:5 distributor:5 storage:5";
+ String s4 = "version:4 distributor:4 storage:4";
+ String s3 = "version:3 distributor:3 storage:3";
+ String s2 = "version:2 distributor:2 storage:2";
+
assertThat(versionTracker.getClusterStateHistory(),
equalTo(Arrays.asList(
- historyEntry("version:4 distributor:4 storage:4", 300),
- historyEntry("version:3 distributor:3 storage:3", 200))));
+ historyEntry(s4, s3, 300),
+ historyEntry(s3, s2, 200))));
updateAndPromote(versionTracker, stateWithoutAnnotations("distributor:5 storage:5"), 400);
assertThat(versionTracker.getClusterStateHistory(),
equalTo(Arrays.asList(
- historyEntry("version:5 distributor:5 storage:5", 400),
- historyEntry("version:4 distributor:4 storage:4", 300))));
+ historyEntry(s5, s4, 400),
+ historyEntry(s4, s3, 300))));
}
@Test