@Test public void down_to_down_edge_keeps_group_down() { GroupAvailabilityCalculator calc = calcForHierarchicCluster( DistributionBuilder.withGroups(2).eachWithNodeCount(4), 0.76); assertThat(calc.nodesThatShouldBeDown(clusterState( "distributor:8 storage:8 .1.s:d")), equalTo(indices(0, 2, 3))); assertThat(calc.nodesThatShouldBeDown(clusterState( "distributor:8 storage:8 .1.s:d .2.s:d")), equalTo(indices(0, 3))); }
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);  }