Class OrderedNodePlacementPlugin
- java.lang.Object
-
- org.apache.solr.cluster.placement.plugins.OrderedNodePlacementPlugin
-
- All Implemented Interfaces:
PlacementPlugin
- Direct Known Subclasses:
AffinityPlacementFactory.AffinityPlacementPlugin,RandomPlacementFactory.RandomPlacementPlugin,SimplePlacementFactory.SimplePlacementPlugin
public abstract class OrderedNodePlacementPlugin extends Object implements PlacementPlugin
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOrderedNodePlacementPlugin.WeightedNodeA class that determines the weight of a given node and the replicas that reside on it.
-
Constructor Summary
Constructors Constructor Description OrderedNodePlacementPlugin()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description BalancePlancomputeBalancing(BalanceRequest balanceRequest, PlacementContext placementContext)Request from plugin code to compute a balancing of replicas.List<PlacementPlan>computePlacements(Collection<PlacementRequest> requests, PlacementContext placementContext)Request from plugin code to compute multiple placements.protected abstract Map<Node,OrderedNodePlacementPlugin.WeightedNode>getBaseWeightedNodes(PlacementContext placementContext, Set<Node> nodes, Iterable<SolrCollection> relevantCollections, boolean skipNodesWithErrors)protected Map<Node,OrderedNodePlacementPlugin.WeightedNode>getWeightedNodes(PlacementContext placementContext, Set<Node> nodes, Iterable<SolrCollection> relevantCollections, boolean skipNodesWithErrors)voidverifyAllowedModification(ModificationRequest modificationRequest, PlacementContext placementContext)Verify that a collection layout modification doesn't violate constraints on replica placements required by this plugin.protected voidverifyDeleteCollection(DeleteCollectionRequest deleteCollectionRequest, PlacementContext placementContext)protected voidverifyDeleteReplicas(DeleteReplicasRequest deleteReplicasRequest, PlacementContext placementContext)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.solr.cluster.placement.PlacementPlugin
computePlacement
-
-
-
-
Method Detail
-
computePlacements
public List<PlacementPlan> computePlacements(Collection<PlacementRequest> requests, PlacementContext placementContext) throws PlacementException
Description copied from interface:PlacementPluginRequest from plugin code to compute multiple placements. If multiple placements are requested, then thePlacementPlancomputed for eachPlacementRequestwill be used to affect the starting state for each subsequentPlacementRequestin the list. This means that eachPlacementRequestis computed in the context of the previousPlacementRequest's already having been implemented. Note this method must be reentrant as a plugin instance may (read will) get multiple such calls in parallel.Configuration is passed upon creation of a new instance of this class by
PlacementPluginFactory.createPluginInstance().- Specified by:
computePlacementsin interfacePlacementPlugin- Parameters:
requests- requests for placing new replicas or moving existing replicas on the cluster.- Returns:
- plan satisfying all placement requests.
- Throws:
PlacementException
-
computeBalancing
public BalancePlan computeBalancing(BalanceRequest balanceRequest, PlacementContext placementContext) throws PlacementException
Description copied from interface:PlacementPluginRequest from plugin code to compute a balancing of replicas. Note this method must be reentrant as a plugin instance may (read will) get multiple such calls in parallel.Configuration is passed upon creation of a new instance of this class by
PlacementPluginFactory.createPluginInstance().- Specified by:
computeBalancingin interfacePlacementPlugin- Parameters:
balanceRequest- request for selecting replicas that should be moved to aid in balancing the replicas across the desired nodes.- Returns:
- plan satisfying all extraction requests.
- Throws:
PlacementException
-
getWeightedNodes
protected Map<Node,OrderedNodePlacementPlugin.WeightedNode> getWeightedNodes(PlacementContext placementContext, Set<Node> nodes, Iterable<SolrCollection> relevantCollections, boolean skipNodesWithErrors) throws PlacementException
- Throws:
PlacementException
-
getBaseWeightedNodes
protected abstract Map<Node,OrderedNodePlacementPlugin.WeightedNode> getBaseWeightedNodes(PlacementContext placementContext, Set<Node> nodes, Iterable<SolrCollection> relevantCollections, boolean skipNodesWithErrors) throws PlacementException
- Throws:
PlacementException
-
verifyAllowedModification
public void verifyAllowedModification(ModificationRequest modificationRequest, PlacementContext placementContext) throws PlacementException
Description copied from interface:PlacementPluginVerify that a collection layout modification doesn't violate constraints on replica placements required by this plugin. Default implementation is a no-op (any modifications are allowed).- Specified by:
verifyAllowedModificationin interfacePlacementPlugin- Parameters:
modificationRequest- modification request.placementContext- placement context.- Throws:
PlacementModificationException- if the requested modification would violate replica placement constraints.PlacementException
-
verifyDeleteCollection
protected void verifyDeleteCollection(DeleteCollectionRequest deleteCollectionRequest, PlacementContext placementContext) throws PlacementException
- Throws:
PlacementException
-
verifyDeleteReplicas
protected void verifyDeleteReplicas(DeleteReplicasRequest deleteReplicasRequest, PlacementContext placementContext) throws PlacementException
- Throws:
PlacementException
-
-