Class TabletBalancer
- java.lang.Object
-
- org.apache.accumulo.server.master.balancer.TabletBalancer
-
- All Implemented Interfaces:
TabletBalancer
- Direct Known Subclasses:
DefaultLoadBalancer
,GroupBalancer
,TableLoadBalancer
@Deprecated(since="2.1.0") public abstract class TabletBalancer extends Object implements TabletBalancer
Deprecated.since 2.1.0. UseTabletBalancer
instead.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 usingProperty.TABLE_ARBITRARY_PROP_PREFIX
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
TabletBalancer.BalancerProblem
Deprecated.A deferred call descendent TabletBalancers use to log why they can't continue.protected static class
TabletBalancer.NoTservers
Deprecated.If a TabletBalancer requires active tservers, it should use this problem to indicate when there are none.protected static class
TabletBalancer.OutstandingMigrations
Deprecated.If a TabletBalancer only balances when there are no outstanding migrations, it should use this problem to indicate when they exist.-
Nested classes/interfaces inherited from interface org.apache.accumulo.core.spi.balancer.TabletBalancer
TabletBalancer.AssignmentParameters, TabletBalancer.BalanceParameters
-
-
Field Summary
Fields Modifier and Type Field Description protected ServerContext
context
Deprecated.protected static long
TIME_BETWEEN_BALANCER_WARNINGS
Deprecated.
-
Constructor Summary
Constructors Constructor Description TabletBalancer()
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract long
balance(SortedMap<TServerInstance,TabletServerStatus> current, Set<KeyExtent> migrations, List<TabletMigration> migrationsOut)
Deprecated.Ask the balancer if any migrations are necessary.long
balance(TabletBalancer.BalanceParameters params)
Deprecated.static List<TabletMigration>
checkMigrationSanity(Set<TServerInstance> current, List<TabletMigration> migrations)
Deprecated.Utility to ensure that the migrations from balance() are consistent: Tablet objects are not null Source and destination tablet servers are not null and currentprotected void
constraintNotMet(TabletBalancer.BalancerProblem cause)
Deprecated.Warn that a Balancer can't work because of some external restriction.abstract void
getAssignments(SortedMap<TServerInstance,TabletServerStatus> current, Map<KeyExtent,TServerInstance> unassigned, Map<KeyExtent,TServerInstance> assignments)
Deprecated.Assign tablets to tablet servers.void
getAssignments(TabletBalancer.AssignmentParameters params)
Deprecated.List<TabletStats>
getOnlineTabletsForTable(TServerInstance tserver, TableId tableId)
Deprecated.Fetch the tablets for the given table by asking the tablet server.void
init(BalancerEnvironment balancerEnvironment)
Deprecated.void
init(ServerConfigurationFactory conf)
Deprecated.since 2.0.0; useinit(ServerContext)
instead.void
init(ServerContext context)
Deprecated.Initialize the TabletBalancer.protected void
resetBalancerErrors()
Deprecated.Resets logging about problems meeting an external constraint on balancing.
-
-
-
Field Detail
-
context
protected ServerContext context
Deprecated.
-
TIME_BETWEEN_BALANCER_WARNINGS
protected static final long TIME_BETWEEN_BALANCER_WARNINGS
Deprecated.- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(BalancerEnvironment balancerEnvironment)
Deprecated.- Specified by:
init
in interfaceTabletBalancer
-
getAssignments
public void getAssignments(TabletBalancer.AssignmentParameters params)
Deprecated.- Specified by:
getAssignments
in interfaceTabletBalancer
-
balance
public long balance(TabletBalancer.BalanceParameters params)
Deprecated.- Specified by:
balance
in interfaceTabletBalancer
-
init
@Deprecated(since="2.0.0") public void init(ServerConfigurationFactory conf)
Deprecated.since 2.0.0; useinit(ServerContext)
instead.Initialize the TabletBalancer. This gives the balancer the opportunity to read the configuration.
-
init
public void init(ServerContext context)
Deprecated.Initialize the TabletBalancer. This gives the balancer the opportunity to read the configuration.- Since:
- 2.0.0
-
getAssignments
public abstract void getAssignments(SortedMap<TServerInstance,TabletServerStatus> current, Map<KeyExtent,TServerInstance> unassigned, Map<KeyExtent,TServerInstance> assignments)
Deprecated.Assign tablets to tablet servers. This method is called whenever the manager finds tablets that are unassigned.- Parameters:
current
- The current table-summary state of all the online tablet servers. Read-only. The TabletServerStatus for each server may be null if the tablet server has not yet responded to a recent request for status.unassigned
- A map from unassigned tablet to the last known tablet server. Read-only.assignments
- A map from tablet to assigned server. Write-only.
-
balance
public abstract long balance(SortedMap<TServerInstance,TabletServerStatus> current, Set<KeyExtent> migrations, List<TabletMigration> migrationsOut)
Deprecated.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.- Parameters:
current
- The current table-summary state of all the online tablet servers. Read-only.migrations
- the current set of migrations. Read-only.migrationsOut
- new migrations to perform; should not contain tablets in the current set of migrations. Write-only.- Returns:
- the time, in milliseconds, to wait before re-balancing. This method will not be called when there are unassigned tablets.
-
constraintNotMet
protected void constraintNotMet(TabletBalancer.BalancerProblem cause)
Deprecated.Warn that a Balancer can't work because of some external restriction. Will not call the provided logging handler more often than TIME_BETWEEN_BALANCER_WARNINGS
-
resetBalancerErrors
protected void resetBalancerErrors()
Deprecated.Resets logging about problems meeting an external constraint on balancing.
-
getOnlineTabletsForTable
public List<TabletStats> getOnlineTabletsForTable(TServerInstance tserver, TableId tableId) throws ThriftSecurityException, org.apache.thrift.TException
Deprecated.Fetch the tablets for the given table by asking the tablet server. Useful if your balance strategy needs details at the tablet level to decide what tablets to move.- Parameters:
tserver
- The tablet server to ask.tableId
- The table id- Returns:
- a list of tablet statistics
- Throws:
ThriftSecurityException
- tablet server disapproves of your internal System password.org.apache.thrift.TException
- any other problem
-
checkMigrationSanity
public static List<TabletMigration> checkMigrationSanity(Set<TServerInstance> current, List<TabletMigration> migrations)
Deprecated.Utility to ensure that the migrations from balance() are consistent:- Tablet objects are not null
- Source and destination tablet servers are not null and current
- Returns:
- A list of TabletMigration object that passed sanity checks.
-
-