@Override public boolean clusterUp() { return clusterState != null && clusterState.getClusterState().oneOf("u"); }
public void updateValidTargets(ClusterState state) { List<Integer> validRandomTargets = new ArrayList<>(); for (int i=0; i<state.getNodeCount(NodeType.DISTRIBUTOR); ++i) { if (state.getNodeState(new Node(NodeType.DISTRIBUTOR, i)).getState().oneOf(upStates)) validRandomTargets.add(i); } this.validRandomTargets = validRandomTargets; this.totalTargets = state.getNodeCount(NodeType.DISTRIBUTOR); } public abstract String getTargetSpec(Integer distributor, RoutingContext context);
@Override public boolean nodeUp() { return !clusterUp() && clusterState.getNodeState(new Node(NodeType.STORAGE, clusterIndex)).getState().oneOf("uir"); } }
private static boolean allDistributorsDown(Group g, ClusterState clusterState) { if (g.isLeafGroup()) { for (ConfiguredNode node : g.getNodes()) { NodeState ns = clusterState.getNodeState(new Node(NodeType.DISTRIBUTOR, node.index())); if (ns.getState().oneOf("ui")) return false; } } else { for (Group childGroup : g.getSubgroups().values()) { if (!allDistributorsDown(childGroup, clusterState)) return false; } } return true; } private Group getIdealDistributorGroup(BucketId bucket, ClusterState clusterState, Group parent, int redundancy) {
if (!nodeState.getState().oneOf(upStates)) { continue;
for (ConfiguredNode configuredNode : configuredNodes) { NodeState nodeState = state.getNodeState(new Node(NodeType.DISTRIBUTOR, configuredNode.index())); if (!nodeState.getState().oneOf(upStates)) continue; if (configuredNode.index() != randomIndex) { if (configuredNode.index() < randomIndex) {