aboutsummaryrefslogtreecommitdiffstats
path: root/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentCluster.java
diff options
context:
space:
mode:
authorHarald Musum <musum@yahooinc.com>2023-03-28 10:43:05 +0200
committerHarald Musum <musum@yahooinc.com>2023-03-28 10:43:05 +0200
commit656524514504c04f669ff61e0708be809d11473c (patch)
tree87316171af4dee3ef2772d6782cf871d8f16889f /clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentCluster.java
parent642acda2e5a28ba06c094e503c662b514efadabe (diff)
Add config for max number of content groups allowed to be down
Diffstat (limited to 'clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentCluster.java')
-rw-r--r--clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/ContentCluster.java22
1 files changed, 19 insertions, 3 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 5d9ec6f5f80..9347fadc0e0 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
@@ -15,7 +15,6 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.TreeMap;
-import java.util.stream.Collectors;
import static com.yahoo.vdslib.state.NodeState.ORCHESTRATOR_RESERVED_DESCRIPTION;
@@ -33,11 +32,25 @@ public class ContentCluster {
private Distribution distribution;
+ private final int maxNumberOfGroupsAllowedToBeDown;
+
public ContentCluster(String clusterName, Collection<ConfiguredNode> configuredNodes, Distribution distribution) {
+ this(clusterName, configuredNodes, distribution, 1);
+ }
+
+ public ContentCluster(FleetControllerOptions options) {
+ this(options.clusterName(), options.nodes(), options.storageDistribution(), options.maxNumberOfGroupsAllowedToBeDown());
+ }
+
+ private ContentCluster(String clusterName,
+ Collection<ConfiguredNode> configuredNodes,
+ Distribution distribution,
+ int maxNumberOfGroupsAllowedToBeDown) {
if (configuredNodes == null) throw new IllegalArgumentException("Nodes must be set");
this.clusterName = clusterName;
this.distribution = distribution;
setNodes(configuredNodes, new NodeListener() {});
+ this.maxNumberOfGroupsAllowedToBeDown = maxNumberOfGroupsAllowedToBeDown;
}
public Distribution getDistribution() { return distribution; }
@@ -95,6 +108,8 @@ public class ContentCluster {
public NodeInfo getNodeInfo(Node node) { return clusterInfo.getNodeInfo(node); }
+ public int maxNumberOfGroupsAllowedToBeDown() { return maxNumberOfGroupsAllowedToBeDown; }
+
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("ContentCluster(").append(clusterName).append(") {");
@@ -121,13 +136,14 @@ public class ContentCluster {
*/
public NodeStateChangeChecker.Result calculateEffectOfNewState(
Node node, ClusterState clusterState, SetUnitStateRequest.Condition condition,
- NodeState oldState, NodeState newState, boolean inMoratorium) {
+ NodeState oldState, NodeState newState, boolean inMoratorium, int maxNumberOfGroupsAllowedToBeDown) {
NodeStateChangeChecker nodeStateChangeChecker = new NodeStateChangeChecker(
distribution.getRedundancy(),
new HierarchicalGroupVisitingAdapter(distribution),
clusterInfo,
- inMoratorium
+ inMoratorium,
+ maxNumberOfGroupsAllowedToBeDown
);
return nodeStateChangeChecker.evaluateTransition(node, clusterState, condition, oldState, newState);
}