From 08e55ca8619e5da823b8fba0f9667abdcc0ee7d4 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Thu, 11 Mar 2021 00:29:19 +0100 Subject: Shrink the size of the NodeState object by using float over double for initProgress and capacity. Also gc unused 'reliability' member. --- .../core/ClusterStateGeneratorTest.java | 14 ++++---- .../core/GroupAutoTakedownTest.java | 2 +- .../clustercontroller/core/RpcServerTest.java | 4 +-- .../clustercontroller/core/StateChangeTest.java | 38 +++++++++++----------- 4 files changed, 29 insertions(+), 29 deletions(-) (limited to 'clustercontroller-core') 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 d5d6c4623f2..01b5cbb8e59 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 @@ -169,7 +169,7 @@ public class ClusterStateGeneratorTest { @Test public void storage_node_in_init_mode_while_listing_buckets_is_marked_down() { final NodeState initWhileListingBuckets = new NodeState(NodeType.STORAGE, State.INITIALIZING); - initWhileListingBuckets.setInitProgress(0.0); + initWhileListingBuckets.setInitProgress(0.0f); final ClusterFixture fixture = ClusterFixture.forFlatCluster(3) .bringEntireClusterUp() @@ -186,7 +186,7 @@ public class ClusterStateGeneratorTest { @Test public void implicit_down_while_listing_buckets_does_not_override_wanted_state() { final NodeState initWhileListingBuckets = new NodeState(NodeType.STORAGE, State.INITIALIZING); - initWhileListingBuckets.setInitProgress(0.0); + initWhileListingBuckets.setInitProgress(0.0f); final ClusterFixture fixture = ClusterFixture.forFlatCluster(3) .bringEntireClusterUp() @@ -200,7 +200,7 @@ public class ClusterStateGeneratorTest { @Test public void distributor_nodes_in_init_mode_are_not_mapped_to_down() { final NodeState initWhileListingBuckets = new NodeState(NodeType.DISTRIBUTOR, State.INITIALIZING); - initWhileListingBuckets.setInitProgress(0.0); + initWhileListingBuckets.setInitProgress(0.0f); final ClusterFixture fixture = ClusterFixture.forFlatCluster(3) .bringEntireClusterUp() @@ -821,7 +821,7 @@ public class ClusterStateGeneratorTest { private String do_test_storage_node_with_no_init_progress(State wantedState) { final ClusterFixture fixture = ClusterFixture.forFlatCluster(3) .bringEntireClusterUp() - .reportStorageNodeState(0, new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.5)) + .reportStorageNodeState(0, new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.5f)) .proposeStorageNodeWantedState(0, wantedState); final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 0)); @@ -863,7 +863,7 @@ public class ClusterStateGeneratorTest { .bringEntireClusterUp() .reportStorageNodeState(0, State.INITIALIZING) .reportStorageNodeState(0, State.DOWN) // Init -> Down triggers unstable init flag - .reportStorageNodeState(0, new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.5)); + .reportStorageNodeState(0, new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.5f)); final AnnotatedClusterState state = generateFromFixtureWithDefaultParams(fixture); assertThat(state.toString(), equalTo("distributor:5 storage:5 .0.s:d")); @@ -873,7 +873,7 @@ public class ClusterStateGeneratorTest { public void storage_node_with_crashes_but_not_unstable_init_does_not_have_init_state_substituted_by_down() { final ClusterFixture fixture = ClusterFixture.forFlatCluster(5) .bringEntireClusterUp() - .reportStorageNodeState(0, new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.5)); + .reportStorageNodeState(0, new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.5f)); final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 0)); nodeInfo.setPrematureCrashCount(5); @@ -926,7 +926,7 @@ public class ClusterStateGeneratorTest { public void configured_zero_init_progress_time_disables_auto_init_to_down_feature() { final ClusterFixture fixture = ClusterFixture.forFlatCluster(3) .bringEntireClusterUp() - .reportStorageNodeState(0, new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.5)); + .reportStorageNodeState(0, new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.5f)); final NodeInfo nodeInfo = fixture.cluster.getNodeInfo(new Node(NodeType.STORAGE, 0)); nodeInfo.setInitProgressTime(10_000); 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 7ab920f384b..a632ec62dc7 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 @@ -266,7 +266,7 @@ public class GroupAutoTakedownTest { DistributionBuilder.withGroups(3).eachWithNodeCount(2), 0.51); final NodeState newState = new NodeState(NodeType.STORAGE, State.INITIALIZING); - newState.setInitProgress(0.5); + newState.setInitProgress(0.5f); fixture.reportStorageNodeState(4, newState); diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/RpcServerTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/RpcServerTest.java index 5ca6c6f2289..30cd1312cad 100644 --- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/RpcServerTest.java +++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/RpcServerTest.java @@ -186,7 +186,7 @@ public class RpcServerTest extends FleetControllerTest { waitForState("version:\\d+ distributor:10 .0.s:d .2.s:d storage:10 .1.s:d .2.s:d .7.s:m"); timer.advanceTime(1000000); waitForCompleteCycle(); // Make fleet controller notice that time has changed before any disconnects - nodes.get(3).setNodeState(new NodeState(nodes.get(3).getType(), State.INITIALIZING).setInitProgress(0.2)); + nodes.get(3).setNodeState(new NodeState(nodes.get(3).getType(), State.INITIALIZING).setInitProgress(0.2f)); nodes.get(3).connect(); waitForState("version:\\d+ distributor:10 .0.s:d .2.s:d storage:10 .1.s:i .1.i:0.2 .2.s:d .7.s:m"); @@ -305,7 +305,7 @@ public class RpcServerTest extends FleetControllerTest { waitForState("version:\\d+ distributor:10 .0.s:d .2.s:d storage:10 .1.s:d .2.s:d .7.s:m .9.s:r"); timer.advanceTime(1000000); waitForCompleteCycle(); // Make fleet controller notice that time has changed before any disconnects - nodes.get(3).setNodeState(new NodeState(nodes.get(3).getType(), State.INITIALIZING).setInitProgress(0.2)); + nodes.get(3).setNodeState(new NodeState(nodes.get(3).getType(), State.INITIALIZING).setInitProgress(0.2f)); nodes.get(3).connect(); waitForState("version:\\d+ distributor:10 .0.s:d .2.s:d storage:10 .1.s:i .1.i:0.2 .2.s:d .7.s:m .9.s:r"); } diff --git a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java index cf2b151e55a..af39e43bb36 100644 --- a/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java +++ b/clustercontroller-core/src/test/java/com/yahoo/vespa/clustercontroller/core/StateChangeTest.java @@ -111,14 +111,14 @@ public class StateChangeTest extends FleetControllerTest { for (int j = 0; j < 10; ++j) { - communicator.setNodeState(new Node(NodeType.DISTRIBUTOR, j), new NodeState(NodeType.DISTRIBUTOR, State.INITIALIZING).setInitProgress(0.0), ""); + communicator.setNodeState(new Node(NodeType.DISTRIBUTOR, j), new NodeState(NodeType.DISTRIBUTOR, State.INITIALIZING).setInitProgress(0.0f), ""); } for (int i=0; i<100; i += 10) { timer.advanceTime(options.maxInitProgressTime / 20); ctrl.tick(); for (int j = 0; j < 10; ++j) { - communicator.setNodeState(new Node(NodeType.STORAGE, j), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(i / 100.0), ""); + communicator.setNodeState(new Node(NodeType.STORAGE, j), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(i / 100.0f), ""); } } @@ -391,14 +391,14 @@ public class StateChangeTest extends FleetControllerTest { tick(1000); - communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.0), ""); + communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.0f), ""); ctrl.tick(); // Still maintenance since .i progress 0.0 is really down. assertEquals("version:4 distributor:10 storage:10 .6.s:m", ctrl.getSystemState().toString()); - communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.6), ""); + communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.6f), ""); ctrl.tick(); @@ -451,14 +451,14 @@ public class StateChangeTest extends FleetControllerTest { tick(1000); - communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.0), ""); + communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.0f), ""); ctrl.tick(); // Still maintenance since .i progress 0.0 is really down. assertEquals("version:4 distributor:10 storage:10 .6.s:m", ctrl.getSystemState().toString()); - communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.6), ""); + communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.6f), ""); ctrl.tick(); @@ -541,13 +541,13 @@ public class StateChangeTest extends FleetControllerTest { assertEquals("version:5 distributor:10 storage:10 .6.s:d", ctrl.getSystemState().toString()); - communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.001), ""); + communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.001f), ""); ctrl.tick(); assertEquals("version:5 distributor:10 storage:10 .6.s:d", ctrl.getSystemState().toString()); - communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.1), ""); + communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.1f), ""); ctrl.tick(); @@ -604,7 +604,7 @@ public class StateChangeTest extends FleetControllerTest { assertEquals("version:5 distributor:10 storage:10 .6.s:d", ctrl.getSystemState().toString()); - communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.1), ""); + communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.1f), ""); ctrl.tick(); @@ -625,11 +625,11 @@ public class StateChangeTest extends FleetControllerTest { tick(options.nodeStateRequestTimeoutMS + 1); - communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.0), ""); + communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.0f), ""); tick(1000); - communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.1), ""); + communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.1f), ""); tick(1000); @@ -691,7 +691,7 @@ public class StateChangeTest extends FleetControllerTest { assertEquals("version:5 distributor:10 storage:10 .6.s:d", ctrl.getSystemState().toString()); - communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.3), ""); + communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.3f), ""); ctrl.tick(); @@ -699,7 +699,7 @@ public class StateChangeTest extends FleetControllerTest { ctrl.tick(); - communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.2), ""); + communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.2f), ""); ctrl.tick(); @@ -735,7 +735,7 @@ public class StateChangeTest extends FleetControllerTest { ctrl.tick(); - communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.3), ""); + communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.3f), ""); ctrl.tick(); @@ -751,7 +751,7 @@ public class StateChangeTest extends FleetControllerTest { tick(1000); - communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.3), ""); + communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.3f), ""); ctrl.tick(); @@ -804,13 +804,13 @@ public class StateChangeTest extends FleetControllerTest { tick(options.nodeStateRequestTimeoutMS + 1); - communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.0), ""); + communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.0f), ""); ctrl.tick(); tick(options.nodeStateRequestTimeoutMS + 1); - communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.1), ""); + communicator.setNodeState(new Node(NodeType.STORAGE, 6), new NodeState(NodeType.STORAGE, State.INITIALIZING).setInitProgress(0.1f), ""); tick(1000); } @@ -1228,7 +1228,7 @@ public class StateChangeTest extends FleetControllerTest { communicator.setNodeState( new Node(NodeType.STORAGE, 2), new NodeState(NodeType.STORAGE, State.INITIALIZING) - .setInitProgress(0.1).setMinUsedBits(16), ""); + .setInitProgress(0.1f).setMinUsedBits(16), ""); ctrl.tick(); @@ -1245,7 +1245,7 @@ public class StateChangeTest extends FleetControllerTest { communicator.setNodeState( new Node(NodeType.STORAGE, 2), new NodeState(NodeType.STORAGE, State.INITIALIZING) - .setInitProgress((i * 0.1) + 0.1).setMinUsedBits(17), ""); + .setInitProgress((i * 0.1f) + 0.1f).setMinUsedBits(17), ""); timer.advanceTime(1000); ctrl.tick(); } -- cgit v1.2.3