@Test public void min_ratio_of_zero_never_takes_down_groups_implicitly() { GroupAvailabilityCalculator calc = calcForHierarchicCluster( DistributionBuilder.withGroups(2).eachWithNodeCount(4), 0.0); assertThat(calc.nodesThatShouldBeDown(clusterState( "distributor:8 storage:8")), equalTo(emptySet())); assertThat(calc.nodesThatShouldBeDown(clusterState( "distributor:8 storage:8 .0.s:d .4.s:d")), equalTo(emptySet())); assertThat(calc.nodesThatShouldBeDown(clusterState( "distributor:8 storage:8 .0.s:d .1.s:d .4.s:d .5.s:d")), equalTo(emptySet())); assertThat(calc.nodesThatShouldBeDown(clusterState( "distributor:8 storage:8 .0.s:d .1.s:d .2.s:d .4.s:d .5.s:d .6.s:d")), equalTo(emptySet())); }
public Set<Integer> nodesThatShouldBeDown(ClusterState state) { if (distribution == null) { return Collections.emptySet(); } if (isFlatCluster(distribution.getRootGroup())) { return new HashSet<>(); } InsufficientAvailabilityGroupVisitor visitor = new InsufficientAvailabilityGroupVisitor(state); distribution.visitGroups(visitor); return visitor.implicitlyDownNodeIndices(); }
GroupAvailabilityCalculator { public Set<Integer> nodesThatShouldBeDown(ClusterState state) { if (distribution == null) { return Collections.emptySet(); } if (isFlatCluster(distribution.getRootGroup())) { return new HashSet<>(); } InsufficientAvailabilityGroupVisitor visitor = new InsufficientAvailabilityGroupVisitor(state); distribution.visitGroups(visitor); return visitor.implicitlyDownNodeIndices(); } }
GroupAvailabilityCalculator { public Set<Integer> nodesThatShouldBeDown(ClusterState state) { if (distribution == null) { return Collections.emptySet(); } if (isFlatCluster(distribution.getRootGroup())) { return new HashSet<>(); } InsufficientAvailabilityGroupVisitor visitor = new InsufficientAvailabilityGroupVisitor(state); distribution.visitGroups(visitor); return visitor.implicitlyDownNodeIndices(); } private  GroupAvailabilityCalculator(Distribution distribution,
                                        double minNodeRatioPerGroup); }
GroupAvailabilityCalculator { public Set<Integer> nodesThatShouldBeDown(ClusterState state) { if (distribution == null) { return Collections.emptySet(); } if (isFlatCluster(distribution.getRootGroup())) { return new HashSet<>(); } InsufficientAvailabilityGroupVisitor visitor = new InsufficientAvailabilityGroupVisitor(state); distribution.visitGroups(visitor); return visitor.implicitlyDownNodeIndices(); } private  GroupAvailabilityCalculator(Distribution distribution,
                                        double minNodeRatioPerGroup); static Builder builder(); Set<Integer> nodesThatShouldBeDown(ClusterState state); }
GroupAvailabilityCalculator { public Set<Integer> nodesThatShouldBeDown(ClusterState state) { if (distribution == null) { return Collections.emptySet(); } if (isFlatCluster(distribution.getRootGroup())) { return new HashSet<>(); } InsufficientAvailabilityGroupVisitor visitor = new InsufficientAvailabilityGroupVisitor(state); distribution.visitGroups(visitor); return visitor.implicitlyDownNodeIndices(); } private  GroupAvailabilityCalculator(Distribution distribution,
                                        double minNodeRatioPerGroup); static Builder builder(); Set<Integer> nodesThatShouldBeDown(ClusterState state);  }