Interface PlacementPlugin
-
- All Known Implementing Classes:
AffinityPlacementFactory.AffinityPlacementPlugin,OrderedNodePlacementPlugin,RandomPlacementFactory.RandomPlacementPlugin,SimplePlacementFactory.SimplePlacementPlugin
public interface PlacementPluginImplemented by external plugins to control replica placement and movement on the search cluster (as well as other things such as cluster elasticity?) when cluster changes are required (initiated elsewhere, most likely following a Collection API call).Instances of classes implementing this interface are created by
PlacementPluginFactoryImplementations of this interface must be reentrant.
computePlacement(org.apache.solr.cluster.placement.PlacementRequest, org.apache.solr.cluster.placement.PlacementContext)will be called concurrently from many threads.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description BalancePlancomputeBalancing(BalanceRequest balanceRequest, PlacementContext placementContext)Request from plugin code to compute a balancing of replicas.default PlacementPlancomputePlacement(PlacementRequest placementRequest, PlacementContext placementContext)Request from plugin code to compute placement.List<PlacementPlan>computePlacements(Collection<PlacementRequest> placementRequests, PlacementContext placementContext)Request from plugin code to compute multiple placements.default voidverifyAllowedModification(ModificationRequest modificationRequest, PlacementContext placementContext)Verify that a collection layout modification doesn't violate constraints on replica placements required by this plugin.
-
-
-
Method Detail
-
computePlacement
default PlacementPlan computePlacement(PlacementRequest placementRequest, PlacementContext placementContext) throws PlacementException, InterruptedException
Request from plugin code to compute placement. 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().- Parameters:
placementRequest- request for placing new replicas or moving existing replicas on the cluster.- Returns:
- plan satisfying the placement request.
- Throws:
PlacementExceptionInterruptedException
-
computePlacements
List<PlacementPlan> computePlacements(Collection<PlacementRequest> placementRequests, PlacementContext placementContext) throws PlacementException, InterruptedException
Request 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().- Parameters:
placementRequests- requests for placing new replicas or moving existing replicas on the cluster.- Returns:
- plan satisfying all placement requests.
- Throws:
PlacementExceptionInterruptedException
-
computeBalancing
BalancePlan computeBalancing(BalanceRequest balanceRequest, PlacementContext placementContext) throws PlacementException, InterruptedException
Request 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().- 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:
PlacementExceptionInterruptedException
-
verifyAllowedModification
default void verifyAllowedModification(ModificationRequest modificationRequest, PlacementContext placementContext) throws PlacementException, InterruptedException
Verify 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).- Parameters:
modificationRequest- modification request.placementContext- placement context.- Throws:
PlacementModificationException- if the requested modification would violate replica placement constraints.PlacementExceptionInterruptedException
-
-