public interface PartitionAssignmentStrategy
The PartitionAssignmentStrategy is initialized when a PartitionedService
member becomes the distribution coordinator. The service will periodically
ask the strategy to analyze the distribution, and to make distribution
recommendations to the DistributionManager
. Strategies may be
stateful (e.g. some strategies may formulate recommendations based on trends
over accumulated statistics).
Modifier and Type | Method and Description |
---|---|
long |
analyzeDistribution()
Analyze the distribution and return the desired time interval before the
next distribution analysis.
|
void |
analyzeOrphans(Map<Member,PartitionSet> mapConstraints)
Analyze and suggest the assignment of orphaned partitions (partitions
without an active primary or backup owner) subject to the specified
constraints.
|
String |
getDescription()
Return a human-readable description of the state of the partition
assignment.
|
void |
init(DistributionManager manager)
Initialize the PartitionAssignmentStrategy and bind it to the specified
DistributionManager.
|
void init(DistributionManager manager)
analysis
.manager
- the DistributionManager that this strategy is bound tovoid analyzeOrphans(Map<Member,PartitionSet> mapConstraints)
The strategy must provide suggestions for all orphaned partitions which are consistent with the supplied constraints. Failure to provide a complete set of valid suggestions may result in the loss of partition data.
mapConstraints
- the map of assignment constraints associating
members with the set of partitions that they could
be assigned ownership oflong analyzeDistribution()
As a result of failover, partitions may become 'endangered', meaning that the necessary number of backups do not exist. Failure to suggest a distribution recovery plan for those partitions may result in the partition remaining in the endangered state. Additionally, ownership-enabled service members that are in the process of shutting down will wait until all owned partitions are transferred out. Failure to suggest a distribution plan may delay the exit of these leaving members.
The statistics and ownership information exposed by the DistributionManager will not mutate for the duration of this method call.
String getDescription()