int replica = idealState.getReplicaCount(preferenceList.size()); Set<String> activeList = new HashSet<>(preferenceList); activeList.retainAll(cache.getEnabledLiveInstances());
int replica = idealState.getReplicaCount(preferenceList.size()); Set<String> activeList = new HashSet<>(preferenceList); activeList.retainAll(cache.getEnabledLiveInstances());
int replicas = currentIdealState.getReplicaCount(liveInstance.size());
int replicas = currentIdealState.getReplicaCount(liveInstance.size());
if (!allPartitionNames.isEmpty()) { for (String partitionName : allPartitionNames) { int replicaCount = idealState.getReplicaCount(idealState.getPreferenceList(partitionName).size());
clusterData.getStateModelDef(currentIdealState.getStateModelDefRef()); int replicaCount = currentIdealState.getReplicaCount(activeNodes.size()); if (replicaCount == 0) { LOG.error("Replica count is 0 for resource " + resourceName
clusterData.getStateModelDef(currentIdealState.getStateModelDefRef()); int replicaCount = currentIdealState.getReplicaCount(activeNodes.size()); if (replicaCount == 0) { LOG.error("Replica count is 0 for resource " + resourceName
@Override public void onExternalViewChange(List<ExternalView> externalViewList, NotificationContext changeContext) { if (!trackEnabled) { return; } for (ExternalView ev : externalViewList) { IdealState is = _resourceMap.get(ev.getResourceName()); if (is == null) { continue; } int replica = is.getReplicaCount(NUM_NODE); for (String p : is.getPartitionSet()) { Map<String, String> stateMap = ev.getStateMap(p); verifyPartitionCount(is.getResourceName(), p, stateMap, replica, "EV", is.getMinActiveReplicas()); } } }
@Override public void onIdealStateChange(List<IdealState> idealStates, NotificationContext changeContext) throws InterruptedException { if (!trackEnabled) { return; } for (IdealState is : idealStates) { int replica = is.getReplicaCount(NUM_NODE); for (String p : is.getPartitionSet()) { Map<String, String> stateMap = is.getRecord().getMapField(p); verifyPartitionCount(is.getResourceName(), p, stateMap, replica, "IS", is.getMinActiveReplicas()); } } }
/** * Validate instances for each partition is on different zone and with necessary tagged * instances. */ private void validateNoZeroReplica(IdealState is, ExternalView ev) { int replica = is.getReplicaCount(NUM_NODE); StateModelDefinition stateModelDef = BuiltInStateModelDefinitions.valueOf(is.getStateModelDefRef()).getStateModelDefinition(); for (String partition : is.getPartitionSet()) { Map<String, String> evStateMap = ev.getRecord().getMapField(partition); Map<String, String> isStateMap = is.getInstanceStateMap(partition); validateMap(is.getResourceName(), partition, replica, evStateMap, stateModelDef); validateMap(is.getResourceName(), partition, replica, isStateMap, stateModelDef); } }