Examples of addReplicaMap()


Examples of org.apache.helix.model.ResourceAssignment.addReplicaMap()

        // enforce that a participant can only have one instance of a given lock
        if (!replicaMap.containsKey(participant)) {
          replicaMap.put(participant, lockState);
        }
      }
      assignment.addReplicaMap(partition, replicaMap);
      i++;
    }
    return assignment;
  }
}
View Full Code Here

Examples of org.apache.helix.model.ResourceAssignment.addReplicaMap()

    replicaMap.put(ParticipantId.from("localhost_12918"), State.from("MASTER"));
    replicaMap.put(ParticipantId.from("localhost_12919"), State.from("SLAVE"));
    replicaMap.put(ParticipantId.from("localhost_12920"), State.from("SLAVE"));
    replicaMap.put(ParticipantId.from("localhost_12921"), State.from("OFFLINE"));
    replicaMap.put(ParticipantId.from("localhost_12922"), State.from("DROPPED"));
    assignment.addReplicaMap(PartitionId.from(testDB_0), replicaMap);
    bestPossibleStates.setResourceAssignment(ResourceId.from(testDB), assignment);

    Map<String, InstanceConfig> instanceConfigMap = Maps.newHashMap();
    for (int i = 0; i < n; i++) {
      String instanceName = "localhost_" + (12918 + i);
View Full Code Here

Examples of org.apache.helix.model.ResourceAssignment.addReplicaMap()

    Assert.assertTrue(value instanceof Long);
    Assert.assertEquals((Long) value, new Long(0));

    // Missing localhost_12918 in best possible ideal-state should remove it from mbean
    replicaMap.remove(ParticipantId.from("localhost_12918"));
    assignment.addReplicaMap(PartitionId.from(testDB_0), replicaMap);
    bestPossibleStates.setResourceAssignment(ResourceId.from(testDB), assignment);
    monitor.setPerInstanceResourceStatus(bestPossibleStates, instanceConfigMap, resourceMap,
        stateModelDefMap);
    try {
      objName =
View Full Code Here

Examples of org.apache.helix.model.ResourceAssignment.addReplicaMap()

    for (IdealState idealState : idealStates) {
      ResourceId resourceId = idealState.getResourceId();
      ResourceAssignment assignment = new ResourceAssignment(resourceId);
      for (PartitionId partitionId : idealState.getPartitionIdSet()) {
        Map<ParticipantId, State> emptyMap = Collections.emptyMap();
        assignment.addReplicaMap(partitionId, emptyMap);
      }
      output.setResourceAssignment(resourceId, assignment);
    }
    return output;
  }
View Full Code Here

Examples of org.apache.helix.model.ResourceAssignment.addReplicaMap()

          ConstraintBasedAssignment.getDisabledParticipants(cluster.getParticipantMap(),
              partitionId);
      Map<State, String> upperBounds =
          ConstraintBasedAssignment
              .stateConstraints(stateModelDef, resourceId, cluster.getConfig());
      partitionMapping.addReplicaMap(partitionId, ConstraintBasedAssignment
          .computeAutoBestStateForPartition(upperBounds, cluster.getLiveParticipantMap().keySet(),
              stateModelDef, null, currentStateOutput.getCurrentStateMap(resourceId, partitionId),
              disabledParticipantsForPartition, true));
    }
    return partitionMapping;
View Full Code Here

Examples of org.apache.helix.model.ResourceAssignment.addReplicaMap()

    // Construct a ResourceAssignment object from the map of partition assignments.
    ResourceAssignment ra = new ResourceAssignment(ResourceId.from(jobResource));
    for (Map.Entry<Integer, PartitionAssignment> e : paMap.entrySet()) {
      PartitionAssignment pa = e.getValue();
      ra.addReplicaMap(PartitionId.from(pName(jobResource, e.getKey())),
          ImmutableMap.of(ParticipantId.from(pa._instance), State.from(pa._state)));
    }
    return ra;
  }
View Full Code Here

Examples of org.apache.helix.model.ResourceAssignment.addReplicaMap()

          currStateOutput.getCurrentStateMap(resourceId, partition);
      Map<ParticipantId, State> replicaMap = Maps.newHashMap();
      for (ParticipantId participantId : currentStateMap.keySet()) {
        replicaMap.put(participantId, State.from(HelixDefinedState.DROPPED));
      }
      assignment.addReplicaMap(partition, replicaMap);
    }
    return assignment;
  }

  private static void addCompletedPartitions(Set<Integer> set, JobContext ctx,
View Full Code Here

Examples of org.apache.helix.model.ResourceAssignment.addReplicaMap()

    for (IdealState idealState : idealStates) {
      ResourceId resourceId = idealState.getResourceId();
      ResourceAssignment assignment = new ResourceAssignment(resourceId);
      for (PartitionId partitionId : idealState.getPartitionIdSet()) {
        Map<ParticipantId, State> emptyMap = Collections.emptyMap();
        assignment.addReplicaMap(partitionId, emptyMap);
      }
      output.setResourceAssignment(resourceId, assignment);
    }
    return output;
  }
View Full Code Here

Examples of org.apache.helix.model.ResourceAssignment.addReplicaMap()

        // enforce that a participant can only have one instance of a given lock
        if (!replicaMap.containsKey(participant)) {
          replicaMap.put(participant, lockState);
        }
      }
      assignment.addReplicaMap(partition, replicaMap);
      i++;
    }
    return assignment;
  }
}
View Full Code Here

Examples of org.apache.helix.model.ResourceAssignment.addReplicaMap()

        Map<ParticipantId, State> replicaMap =
            ConstraintBasedAssignment.computeCustomizedBestStateForPartition(cluster
                .getLiveParticipantMap().keySet(), stateModelDef, newIdealState
                .getParticipantStateMap(partitionId), currentState.getCurrentStateMap(resourceId,
                partitionId), disabledParticipants);
        assignment.addReplicaMap(partitionId, replicaMap);
      }
    } else {
      // other modes use auto assignment
      Map<State, String> upperBounds =
          ConstraintBasedAssignment
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.