stateModelDef.getStateCountMap(activeList.size(), replica); // StateModelDefinition's counts
stateModelDef.getStateCountMap(activeList.size(), replica); // StateModelDefinition's counts
private void validateMap(String resource, String partition, int replica, Map<String, String> instanceStateMap, StateModelDefinition stateModelDef) { if (instanceStateMap == null || instanceStateMap.isEmpty()) { _testSuccess = false; Assert.fail( String.format("Resource %s partition %s has no active replica!", resource, partition)); } if (instanceStateMap.size() < replica) { _testSuccess = false; Assert.fail(String .format("Resource %s partition %s has %d active replica, less than required %d!", resource, partition, instanceStateMap.size(), replica)); } Map<String, Integer> stateCountMap = stateModelDef.getStateCountMap(NUM_NODE, replica); String topState = stateModelDef.getStatesPriorityList().get(0); if (stateCountMap.get(topState) == 1) { int topCount = 0; for (String val : instanceStateMap.values()) { if (topState.equals(val)) { topCount++; } } if (topCount > 1) { _testSuccess = false; Assert.fail(String .format("Resource %s partition %s has %d replica in %s, more than 1!", resource, partition, topCount, topState)); } } }
.getStateCountMap(liveInstances.size(), Integer.parseInt(idealState.getReplicas())), idealState.getMaxPartitionsPerInstance());
.getStateCountMap(liveInstances.size(), Integer.parseInt(idealState.getReplicas())), idealState.getMaxPartitionsPerInstance());
.getStateCountMap(liveInstance.size(), replicas); List<String> liveNodes = new ArrayList<String>(liveInstance.keySet()); List<String> allNodes = new ArrayList<String>(clusterData.getInstanceConfigMap().keySet());
.getStateCountMap(liveInstance.size(), replicas); List<String> liveNodes = new ArrayList<>(liveInstance.keySet()); List<String> allNodes = new ArrayList<>(clusterData.getAllInstances());
stateModelDef.getStateCountMap(replicaCount, replicaCount);
stateModelDef.getStateCountMap(activeNodes.size(), replicaCount); Map<String, Map<String, String>> currentMapping = currentMapping(currentStateOutput, resourceName, allPartitions, stateCountMap);
stateModelDef.getStateCountMap(activeNodes.size(), replicaCount); Map<String, Map<String, String>> currentMapping = currentMapping(currentStateOutput, resourceName, allPartitions, stateCountMap);
stateModelDef.getStateCountMap(numNodes, replica); Set<String> activeStates = stateCount.keySet();
STATE_MODEL.getStateCountMap(liveNodes.size(), REPLICA_COUNT); ZNRecord znRecord = new AutoRebalanceStrategy(RESOURCE_NAME, partitions, stateCount) stateCount = STATE_MODEL.getStateCountMap(liveNodes.size(), REPLICA_COUNT); for (String partition : PARTITIONS) { currentMapping.get(partition).put(NODES[0], "MASTER"); stateCount = STATE_MODEL.getStateCountMap(liveNodes.size(), REPLICA_COUNT); stateCount = STATE_MODEL.getStateCountMap(liveNodes.size(), REPLICA_COUNT);
constraintBasedStrategy.init(resourceConfig.getResourceName(), new ArrayList<>(resourceConfig.getPreferenceLists().keySet()), stateModelDefinition .getStateCountMap(_instanceConfigMap.size(), Integer.parseInt(resourceConfig.getNumReplica())), Integer.MAX_VALUE);
constraintBasedStrategy.init(resourceConfig.getResourceName(), new ArrayList<>(resourceConfig.getPreferenceLists().keySet()), stateModelDefinition .getStateCountMap(_instanceConfigMap.size(), Integer.parseInt(resourceConfig.getNumReplica())), Integer.MAX_VALUE);