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 Details

    • WeightedNode

      public WeightedNode(Node node)
  • Method Details

    • getNode

      public Node getNode()
    • getAllReplicasOnNode

      public Set<Replica> getAllReplicasOnNode()
    • getAllReplicaCount

      public int getAllReplicaCount()
    • getCollectionsOnNode

      public Set<String> getCollectionsOnNode()
    • hasCollectionOnNode

      public boolean hasCollectionOnNode(String collection)
    • getShardsOnNode

      public Set<String> getShardsOnNode(String collection)
    • hasShardOnNode

      public boolean hasShardOnNode(Shard shard)
    • getReplicasForShardOnNode

      public Set<Replica> getReplicasForShardOnNode(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 interface Comparable<OrderedNodePlacementPlugin.WeightedNode>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object