aboutsummaryrefslogtreecommitdiffstats
path: root/clustercontroller-core/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'clustercontroller-core/src/main')
-rw-r--r--clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentCluster.java12
-rw-r--r--clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/NodeStateChangeChecker.java18
-rw-r--r--clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/SetNodeStateRequest.java4
3 files changed, 12 insertions, 22 deletions
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentCluster.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentCluster.java
index 9347fadc0e0..9538167c6de 100644
--- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentCluster.java
+++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentCluster.java
@@ -136,15 +136,9 @@ public class ContentCluster {
*/
public NodeStateChangeChecker.Result calculateEffectOfNewState(
Node node, ClusterState clusterState, SetUnitStateRequest.Condition condition,
- NodeState oldState, NodeState newState, boolean inMoratorium, int maxNumberOfGroupsAllowedToBeDown) {
-
- NodeStateChangeChecker nodeStateChangeChecker = new NodeStateChangeChecker(
- distribution.getRedundancy(),
- new HierarchicalGroupVisitingAdapter(distribution),
- clusterInfo,
- inMoratorium,
- maxNumberOfGroupsAllowedToBeDown
- );
+ NodeState oldState, NodeState newState, boolean inMoratorium) {
+
+ NodeStateChangeChecker nodeStateChangeChecker = new NodeStateChangeChecker(this, inMoratorium);
return nodeStateChangeChecker.evaluateTransition(node, clusterState, condition, oldState, newState);
}
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/NodeStateChangeChecker.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/NodeStateChangeChecker.java
index 7a77bb2b571..2025dfef562 100644
--- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/NodeStateChangeChecker.java
+++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/NodeStateChangeChecker.java
@@ -42,17 +42,14 @@ public class NodeStateChangeChecker {
private final HierarchicalGroupVisiting groupVisiting;
private final ClusterInfo clusterInfo;
private final boolean inMoratorium;
+ private final int maxNumberOfGroupsAllowedToBeDown;
- public NodeStateChangeChecker(
- int requiredRedundancy,
- HierarchicalGroupVisiting groupVisiting,
- ClusterInfo clusterInfo,
- boolean inMoratorium,
- int maxNumberOfGroupsAllowedToBeDown) {
- this.requiredRedundancy = requiredRedundancy;
- this.groupVisiting = groupVisiting;
- this.clusterInfo = clusterInfo;
+ public NodeStateChangeChecker(ContentCluster cluster, boolean inMoratorium) {
+ this.requiredRedundancy = cluster.getDistribution().getRedundancy();
+ this.groupVisiting = new HierarchicalGroupVisitingAdapter(cluster.getDistribution());
+ this.clusterInfo = cluster.clusterInfo();
this.inMoratorium = inMoratorium;
+ this.maxNumberOfGroupsAllowedToBeDown = cluster.maxNumberOfGroupsAllowedToBeDown();
}
public static class Result {
@@ -392,8 +389,7 @@ public class NodeStateChangeChecker {
return allowSettingOfWantedState();
}
- private Result checkStorageNodesForDistributor(
- DistributorNodeInfo distributorNodeInfo, List<StorageNode> storageNodes, Node node) {
+ private Result checkStorageNodesForDistributor(DistributorNodeInfo distributorNodeInfo, List<StorageNode> storageNodes, Node node) {
for (StorageNode storageNode : storageNodes) {
if (storageNode.getIndex() == node.getIndex()) {
Integer minReplication = storageNode.getMinCurrentReplicationFactorOrNull();
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/SetNodeStateRequest.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/SetNodeStateRequest.java
index a2e77b4e3dd..1c72594377a 100644
--- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/SetNodeStateRequest.java
+++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/restapiv2/requests/SetNodeStateRequest.java
@@ -126,8 +126,8 @@ public class SetNodeStateRequest extends Request<SetResponse> {
NodeState wantedState = nodeInfo.getUserWantedState();
NodeState newWantedState = getRequestedNodeState(newStates, node);
- Result result = cluster.calculateEffectOfNewState(node, currentClusterState, condition, wantedState, newWantedState,
- inMasterMoratorium, cluster.maxNumberOfGroupsAllowedToBeDown());
+ Result result = cluster.calculateEffectOfNewState(node, currentClusterState, condition, wantedState,
+ newWantedState, inMasterMoratorium);
log.log(Level.FINE, () -> "node=" + node +
" current-cluster-state=" + currentClusterState + // Includes version in output format