protected Map<String, String> computeBestPossibleMapForDisabledResource(Map<String, String> currentStateMap , StateModelDefinition stateModelDef) { Map<String, String> bestPossibleStateMap = new HashMap<String, String>(); for (String instance : currentStateMap.keySet()) { if (!HelixDefinedState.ERROR.name().equals(currentStateMap.get(instance))) { bestPossibleStateMap.put(instance, stateModelDef.getInitialState()); } } return bestPossibleStateMap; }
protected Map<String, String> computeBestPossibleMapForDisabledResource(Map<String, String> currentStateMap , StateModelDefinition stateModelDef) { Map<String, String> bestPossibleStateMap = new HashMap<String, String>(); for (String instance : currentStateMap.keySet()) { if (!HelixDefinedState.ERROR.name().equals(currentStateMap.get(instance))) { bestPossibleStateMap.put(instance, stateModelDef.getInitialState()); } } return bestPossibleStateMap; }
/** * Update per-instance resource bean * @param stateMap partition->state * @tags tags instance tags * @param stateModelDef */ public synchronized void update(Map<Partition, String> stateMap, Set<String> tags, StateModelDefinition stateModelDef) { if (tags == null || tags.isEmpty()) { _tags = ImmutableList.of(ClusterStatusMonitor.DEFAULT_TAG); } else { _tags = Lists.newArrayList(tags); Collections.sort(_tags); } int cnt = 0; for (String state : stateMap.values()) { // Skip DROPPED and initial state (e.g. OFFLINE) if (state.equalsIgnoreCase(HelixDefinedState.DROPPED.name()) || state.equalsIgnoreCase(stateModelDef.getInitialState())) { continue; } cnt++; } _partitions = cnt; }
/** * Update per-instance resource bean * @param stateMap partition->state * @tags tags instance tags * @param stateModelDef */ public synchronized void update(Map<Partition, String> stateMap, Set<String> tags, StateModelDefinition stateModelDef) { if (tags == null || tags.isEmpty()) { _tags = ImmutableList.of(ClusterStatusMonitor.DEFAULT_TAG); } else { _tags = Lists.newArrayList(tags); Collections.sort(_tags); } int cnt = 0; for (String state : stateMap.values()) { // Skip DROPPED and initial state (e.g. OFFLINE) if (state.equalsIgnoreCase(HelixDefinedState.DROPPED.name()) || state.equalsIgnoreCase(stateModelDef.getInitialState())) { continue; } cnt++; } _partitions = cnt; }
private boolean verifyExternalView(ExternalView externalView, PartitionStateMap bestPossibleState, StateModelDefinition stateModelDef) { Set<String> ignoreStates = new HashSet<>( Arrays.asList(stateModelDef.getInitialState(), HelixDefinedState.DROPPED.toString())); Map<String, Map<String, String>> bestPossibleStateMap = convertBestPossibleState(bestPossibleState); removeEntryWithIgnoredStates(bestPossibleStateMap.entrySet().iterator(), ignoreStates); Map<String, Map<String, String>> externalViewMap = externalView.getRecord().getMapFields(); removeEntryWithIgnoredStates(externalViewMap.entrySet().iterator(), ignoreStates); return externalViewMap.equals(bestPossibleStateMap); }
private boolean verifyExternalView(ExternalView externalView, PartitionStateMap bestPossibleState, StateModelDefinition stateModelDef) { Set<String> ignoreStates = new HashSet<>( Arrays.asList(stateModelDef.getInitialState(), HelixDefinedState.DROPPED.toString())); Map<String, Map<String, String>> bestPossibleStateMap = convertBestPossibleState(bestPossibleState); removeEntryWithIgnoredStates(bestPossibleStateMap.entrySet().iterator(), ignoreStates); Map<String, Map<String, String>> externalViewMap = externalView.getRecord().getMapFields(); removeEntryWithIgnoredStates(externalViewMap.entrySet().iterator(), ignoreStates); return externalViewMap.equals(bestPossibleStateMap); }
&& (!isResourceEnabled || disabledInstancesForPartition.contains(instance))) { instanceStateMap.put(instance, stateModelDef.getInitialState());
&& (!isResourceEnabled || disabledInstancesForPartition.contains(instance))) { instanceStateMap.put(instance, stateModelDef.getInitialState());
String next = _stateModelDef.getNextStateForTransition(from, to); if (next == null) { if (from.equals(_stateModelDef.getInitialState()) && !to.equals(HelixDefinedState.ERROR.toString())) { _logger.error("Initial state " + from + " cannot reach " + to + ", state model: "
if (currentStateMap.containsKey(instance)) { if (!currentStateMap.get(instance).equals(HelixDefinedState.ERROR.name())) { bestPossibleStateMap.put(instance, stateModelDef.getInitialState()); bestPossibleStateMap.put(instance, stateModelDef.getInitialState());
&& !state.equals(stateModelDef.getInitialState())) { return RebalanceType.RECOVERY_BALANCE;
if (currentStateMap.containsKey(instance)) { if (!currentStateMap.get(instance).equals(HelixDefinedState.ERROR.name())) { bestPossibleStateMap.put(instance, stateModelDef.getInitialState()); bestPossibleStateMap.put(instance, stateModelDef.getInitialState());
String next = _stateModelDef.getNextStateForTransition(from, to); if (next == null) { if (from.equals(_stateModelDef.getInitialState()) && !to.equals(HelixDefinedState.ERROR.toString())) { _logger.error("Initial state " + from + " cannot reach " + to + ", state model: "
if (!state.equals(_stateModelDef.getInitialState()) && !state.equals(HelixDefinedState.ERROR.toString()) && _stateModelDef.getNextStateForTransition(_stateModelDef.getInitialState(), state) == null) { _logger.error("Initial state " + _stateModelDef.getInitialState() + " should be able to reach all states, state model: " + _stateModelDef.getId()); return false;
&& !state.equals(stateModelDef.getInitialState())) { return RebalanceType.RECOVERY_BALANCE;
if (!state.equals(_stateModelDef.getInitialState()) && !state.equals(HelixDefinedState.ERROR.toString()) && _stateModelDef.getNextStateForTransition(_stateModelDef.getInitialState(), state) == null) { _logger.error("Initial state " + _stateModelDef.getInitialState() + " should be able to reach all states, state model: " + _stateModelDef.getId()); return false;
if (_stateModelDef.getInitialState() == null || _stateModelDef.getInitialState().isEmpty()) { _logger .error("State model does not contain init state, statemodel:" + _stateModelDef.getId()); if (!_stateSet.contains(_stateModelDef.getInitialState())) { _logger.error("Defined states does not include the initial state, state model: " + _stateModelDef.getId());
if (_stateModelDef.getInitialState() == null || _stateModelDef.getInitialState().isEmpty()) { _logger .error("State model does not contain init state, statemodel:" + _stateModelDef.getId()); if (!_stateSet.contains(_stateModelDef.getInitialState())) { _logger.error("Defined states does not include the initial state, state model: " + _stateModelDef.getId());
ExternalView externalView = admin.getResourceExternalView(clusterId, resourceName); StateModelDefinition stateModelDef = admin.getStateModelDef(clusterId, idealState.getStateModelDefRef()); String initialState = stateModelDef.getInitialState(); List<String> statesPriorityList = stateModelDef.getStatesPriorityList(); statesPriorityList = statesPriorityList.subList(0, statesPriorityList.indexOf(initialState)); // Trim stateList to initialState and above
.getPath(); String initState = stateModel.getInitialState(); if (lastCurState.getBucketSize() > 0) {