Interface TabletBalancer

All Known Implementing Classes:
DoNothingBalancer, GroupBalancer, HostRegexTableLoadBalancer, RegexGroupBalancer, SimpleLoadBalancer, TableLoadBalancer

public interface TabletBalancer
This class is responsible for managing the distribution of tablets throughout an Accumulo cluster. In most cases, users will want a balancer implementation which ensures a uniform distribution of tablets, so that no individual tablet server is handling significantly more work than any other.

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
  • Method Details

    • init

      void init(BalancerEnvironment balancerEnvironment)
      Initialize the TabletBalancer. This gives the balancer the opportunity to read the configuration.
    • getAssignments

      void getAssignments(TabletBalancer.AssignmentParameters params)
      Assign tablets to tablet servers. This method is called whenever the manager finds tablets that are unassigned.
    • balance

      long balance(TabletBalancer.BalanceParameters params)
      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

      default boolean needsReassignment(TabletBalancer.CurrentAssignment currentAssignment)

      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