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 -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract booleanaddProjectedReplicaWeights(Replica replica) Add the weights for the given replica to this nodefinal booleanaddReplica(Replica replica) abstract intcalcRelevantWeightWithReplica(Replica replica) abstract intbooleancanAddReplica(Replica replica) canRemoveReplicas(Collection<Replica> replicas) Determine if the given replicas can be removed from the node.intbooleanintgetNode()getReplicasForShardOnNode(Shard shard) getShardsOnNode(String collection) protected ComparablebooleanhasCollectionOnNode(String collection) inthashCode()booleanhasShardOnNode(Shard shard) final voidinitReplica(Replica replica) protected voidinitReplicaWeights(Replica replica) protected abstract voidremoveProjectedReplicaWeights(Replica replica) final voidremoveReplica(Replica replica) toString()
-
Constructor Details
-
WeightedNode
-
-
Method Details
-
getNode
-
getAllReplicasOnNode
-
getAllReplicaCount
public int getAllReplicaCount() -
getCollectionsOnNode
-
hasCollectionOnNode
-
getShardsOnNode
-
hasShardOnNode
-
getReplicasForShardOnNode
-
calcWeight
public abstract int calcWeight() -
calcRelevantWeightWithReplica
-
canAddReplica
-
initReplica
-
initReplicaWeights
-
addReplica
-
addProjectedReplicaWeights
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
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
-
removeProjectedReplicaWeights
-
getTiebreaker
-
compareTo
- Specified by:
compareToin interfaceComparable<OrderedNodePlacementPlugin.WeightedNode>
-
hashCode
public int hashCode() -
equals
-
toString
-