Interface TabletBalancer
- All Known Implementing Classes:
DoNothingBalancer,GroupBalancer,HostRegexTableLoadBalancer,RegexGroupBalancer,SimpleLoadBalancer,TableLoadBalancer
Implementations may wish to store configuration in Accumulo's system configuration using the
Property.GENERAL_ARBITRARY_PROP_PREFIX. They may also benefit from using per-table
configuration using Property.TABLE_ARBITRARY_PROP_PREFIX.
- Since:
- 2.1.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAn interface for grouping parameters required for the balancer to assign unassigned tablets.static interfaceAn interface for grouping parameters required for the balancer to balance tablets.static interfaceProvides access to information related to a tablet that is currently assigned to a tablet server. -
Method Summary
Modifier and TypeMethodDescriptionlongAsk the balancer if any migrations are necessary.voidAssign tablets to tablet servers.voidinit(BalancerEnvironment balancerEnvironment) Initialize the TabletBalancer.default booleanneedsReassignment(TabletBalancer.CurrentAssignment currentAssignment) The manager periodically scans all tablets looking for tablets that are assigned to dead tablet servers or unassigned.
-
Method Details
-
init
Initialize the TabletBalancer. This gives the balancer the opportunity to read the configuration. -
getAssignments
Assign tablets to tablet servers. This method is called whenever the manager finds tablets that are unassigned. -
balance
Ask the balancer if any migrations are necessary. If the balancer is going to self-abort due to some environmental constraint (e.g. it requires some minimum number of tservers, or a maximum number of outstanding migrations), it should issue a log message to alert operators. The message should be at WARN normally and at ERROR if the balancer knows that the problem can not self correct. It should not issue these messages more than once a minute. This method will not be called when there are unassigned tablets.- Returns:
- the time, in milliseconds, to wait before re-balancing.
-
needsReassignment
The manager periodically scans all tablets looking for tablets that are assigned to dead tablet servers or unassigned. During the scan this method is also called for tablets that are currently assigned to a live tserver to see if they should be unassigned and reassigned. If this method returns true the tablet will be unloaded from the tablet sever and then later the tablet will be passed to
getAssignments(AssignmentParameters).One example use case for this method is a balancer that partitions tablet servers into groups. If the balancers config is changed such that a table that was assigned to tablet server group A should now be assigned to tablet server B, then this method can return true for the tablets in that table assigned to tablet server group A. After those tablets are unloaded and passed to the
getAssignments(AssignmentParameters)method it can reassign them to tablet server group B.Accumulo may instantiate this plugin in different processes and call this method. When the manager looks for tablets that needs reassignment it currently uses an Accumulo iterator to scan the metadata table and filter tablets. That iterator may run on multiple tablets servers and call this plugin. Keep this in mind when implementing this plugin and considering keeping state between calls to this method.
This new method may be used instead of or in addition to
balance(BalanceParameters)- Since:
- 4.0.0
-