diff options
author | Harald Musum <musum@verizonmedia.com> | 2023-03-29 21:41:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-29 21:41:37 +0200 |
commit | f03364a0da1d3f7c5f460bf0c80e338aa55f3b25 (patch) | |
tree | d9c3a6486cea5c574fcac5b72b0ed05bef630c1d /clustercontroller-core/src/main/java/com/yahoo | |
parent | 70211538e30cd49226d09d4e65ba17ff40ec2432 (diff) | |
parent | 0dae4ed807b19bf558b508bac057ae479b71c492 (diff) |
Merge pull request #26632 from vespa-engine/hmusum/cleanup-cluster-controller-3v8.148.14
Hmusum/cleanup cluster controller 3
Diffstat (limited to 'clustercontroller-core/src/main/java/com/yahoo')
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 |