Class OrderedNodePlacementPlugin.WeightedNode
- java.lang.Object
-
- org.apache.solr.cluster.placement.plugins.OrderedNodePlacementPlugin.WeightedNode
-
- All Implemented Interfaces:
Comparable<OrderedNodePlacementPlugin.WeightedNode>
- Enclosing class:
- OrderedNodePlacementPlugin
public abstract static class OrderedNodePlacementPlugin.WeightedNode extends Object implements Comparable<OrderedNodePlacementPlugin.WeightedNode>
A class that determines the weight of a given node and the replicas that reside on it.The
OrderedNodePlacementPlugin
uses the weights determined here to place and balance replicas across the cluster. Replicas will be placed onto WeightedNodes with lower weights, and be taken off of WeightedNodes with higher weights.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Constructor Summary
Constructors Constructor Description WeightedNode(Node node)
-
Method Summary
-
-
-
Constructor Detail
-
WeightedNode
public WeightedNode(Node node)
-
-
Method Detail
-
getNode
public Node getNode()
-
getAllReplicaCount
public int getAllReplicaCount()
-
hasCollectionOnNode
public boolean hasCollectionOnNode(String collection)
-
hasShardOnNode
public boolean hasShardOnNode(Shard shard)
-
calcWeight
public abstract int calcWeight()
-
calcRelevantWeightWithReplica
public abstract int calcRelevantWeightWithReplica(Replica replica)
-
canAddReplica
public boolean canAddReplica(Replica replica)
-
initReplica
public final void initReplica(Replica replica)
-
initReplicaWeights
protected void initReplicaWeights(Replica replica)
-
addReplica
public final boolean addReplica(Replica replica)
-
addProjectedReplicaWeights
protected abstract boolean addProjectedReplicaWeights(Replica replica)
Add the weights for the given replica to this node- Parameters:
replica
- the replica to add weights for- Returns:
- a whether the ordered list of nodes needs a resort afterwords.
-
canRemoveReplicas
public Map<Replica,String> canRemoveReplicas(Collection<Replica> replicas)
Determine if the given replicas can be removed from the node.- Parameters:
replicas
- the replicas to remove- Returns:
- a mapping from replicas that cannot be removed to the reason why they can't be removed.
-
removeReplica
public final void removeReplica(Replica replica)
-
removeProjectedReplicaWeights
protected abstract void removeProjectedReplicaWeights(Replica replica)
-
getTiebreaker
protected Comparable getTiebreaker()
-
compareTo
public int compareTo(OrderedNodePlacementPlugin.WeightedNode o)
- Specified by:
compareTo
in interfaceComparable<OrderedNodePlacementPlugin.WeightedNode>
-
-