Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.helix.controller.rebalancer.waged.constraints.HardConstraint;
import org.apache.helix.controller.rebalancer.waged.model.ClusterModel;
import org.apache.helix.model.IdealState;
import org.apache.helix.model.ResourceAssignment;

import java.util.Map;

Expand All @@ -40,6 +41,6 @@ public interface RebalanceAlgorithm {
* If the map is null, no failure will be returned.
* @return A map <ResourceName, FailureReason> of the rebalanced resource assignments that are saved in the IdeaStates.
*/
Map<String, IdealState> rebalance(ClusterModel clusterModel,
Map<String, ResourceAssignment> rebalance(ClusterModel clusterModel,
Map<String, Map<HardConstraint.FailureReason, Integer>> failureReasons);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.helix.controller.rebalancer.waged.RebalanceAlgorithm;
import org.apache.helix.controller.rebalancer.waged.model.ClusterModel;
import org.apache.helix.model.IdealState;
import org.apache.helix.model.ResourceAssignment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -42,7 +43,7 @@ public ConstraintsRebalanceAlgorithm() {
}

@Override
public Map<String, IdealState> rebalance(ClusterModel clusterModel,
public Map<String, ResourceAssignment> rebalance(ClusterModel clusterModel,
Map<String, Map<HardConstraint.FailureReason, Integer>> failureReasons) {
return new HashMap<>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import org.apache.helix.HelixException;
import org.apache.helix.model.IdealState;
import org.apache.helix.model.ResourceAssignment;

import java.util.Collections;
import java.util.Map;
Expand All @@ -40,10 +41,10 @@ public class ClusterModel {
private final Map<String, AssignableNode> _assignableNodeMap;

// Records about the previous assignment
// <ResourceName, IdealState contains the baseline assignment>
private final Map<String, IdealState> _baselineAssignment;
// <ResourceName, IdealState contains the best possible assignment>
private final Map<String, IdealState> _bestPossibleAssignment;
// <ResourceName, ResourceAssignment contains the baseline assignment>
private final Map<String, ResourceAssignment> _baselineAssignment;
// <ResourceName, ResourceAssignment contains the best possible assignment>
private final Map<String, ResourceAssignment> _bestPossibleAssignment;

/**
* @param clusterContext The initialized cluster context.
Expand All @@ -54,8 +55,8 @@ public class ClusterModel {
* @param bestPossibleAssignment The current best possible assignment.
*/
ClusterModel(ClusterContext clusterContext, Set<AssignableReplica> assignableReplicas,
Set<AssignableNode> assignableNodes, Map<String, IdealState> baselineAssignment,
Map<String, IdealState> bestPossibleAssignment) {
Set<AssignableNode> assignableNodes, Map<String, ResourceAssignment> baselineAssignment,
Map<String, ResourceAssignment> bestPossibleAssignment) {
_clusterContext = clusterContext;

// Save all the to be assigned replication
Expand Down Expand Up @@ -87,11 +88,11 @@ public Map<String, Set<AssignableReplica>> getAssignableReplicaMap() {
return _assignableReplicaMap;
}

public Map<String, IdealState> getBaseline() {
public Map<String, ResourceAssignment> getBaseline() {
return _baselineAssignment;
}

public Map<String, IdealState> getBestPossibleAssignment() {
public Map<String, ResourceAssignment> getBestPossibleAssignment() {
return _bestPossibleAssignment;
}

Expand Down