Class TableLoadBalancer
- All Implemented Interfaces:
TabletBalancer
- Direct Known Subclasses:
HostRegexTableLoadBalancer
Property.TABLE_LOAD_BALANCER. This allows for different Tables to specify different
TabletBalancer classes.
Note that in versions prior to 4.0 this class would pass all known TabletServers to the Table
load balancers. In version 4.0 this changed with the introduction of the
"table.custom.assignment.group" table property. If defined, this balancer passes the
TabletServers that have the corresponding Property.TSERV_GROUP_NAME property to the Table
load balancer.
- Since:
- 2.1.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.accumulo.core.spi.balancer.TabletBalancer
TabletBalancer.AssignmentParameters, TabletBalancer.BalanceParameters, TabletBalancer.CurrentAssignment -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongAsk the balancer if any migrations are necessary.voidAssign tablets to tablet servers.protected TabletBalancergetBalancerForTable(TableId tableId) protected Stringprotected ResourceGroupIdvoidinit(BalancerEnvironment balancerEnvironment) Initialize the TabletBalancer.booleanneedsReassignment(TabletBalancer.CurrentAssignment currentAssignment) The manager periodically scans all tablets looking for tablets that are assigned to dead tablet servers or unassigned.
-
Field Details
-
TABLE_ASSIGNMENT_GROUP_PROPERTY
- See Also:
-
environment
-
-
Constructor Details
-
TableLoadBalancer
public TableLoadBalancer()
-
-
Method Details
-
init
Description copied from interface:TabletBalancerInitialize the TabletBalancer. This gives the balancer the opportunity to read the configuration.- Specified by:
initin interfaceTabletBalancer
-
getLoadBalancerClassNameForTable
-
getResourceGroupNameForTable
-
getBalancerForTable
-
getAssignments
Description copied from interface:TabletBalancerAssign tablets to tablet servers. This method is called whenever the manager finds tablets that are unassigned.- Specified by:
getAssignmentsin interfaceTabletBalancer
-
needsReassignment
Description copied from interface:TabletBalancerThe 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
TabletBalancer.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
TabletBalancer.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
TabletBalancer.balance(BalanceParameters)- Specified by:
needsReassignmentin interfaceTabletBalancer
-
balance
Description copied from interface:TabletBalancerAsk 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.- Specified by:
balancein interfaceTabletBalancer- Returns:
- the time, in milliseconds, to wait before re-balancing.
-