org.apache.accumulo.server.master.balancer
public abstract class TabletBalancer extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
TabletBalancer.BalancerProblem
A deferred call descendent TabletBalancers use to log why they can't continue.
|
protected static class |
TabletBalancer.NoTservers
If a TabletBalancer requires active tservers, it should use this problem to indicate when there are none.
|
protected static class |
TabletBalancer.OutstandingMigrations
If a TabletBalancer only balances when there are no outstanding migrations, it should use this problem to indicate when they exist.
|
Modifier and Type | Field and Description |
---|---|
protected ServerConfiguration |
configuration |
protected static long |
TIME_BETWEEN_BALANCER_WARNINGS |
Constructor and Description |
---|
TabletBalancer() |
Modifier and Type | Method and Description |
---|---|
abstract long |
balance(SortedMap<TServerInstance,TabletServerStatus> current,
Set<KeyExtent> migrations,
List<TabletMigration> migrationsOut)
Ask the balancer if any migrations are necessary.
|
static List<TabletMigration> |
checkMigrationSanity(Set<TServerInstance> current,
List<TabletMigration> migrations)
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
|
protected void |
constraintNotMet(TabletBalancer.BalancerProblem cause)
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)
Assign tablets to tablet servers.
|
List<TabletStats> |
getOnlineTabletsForTable(TServerInstance tserver,
String tableId)
Fetch the tablets for the given table by asking the tablet server.
|
void |
init(ServerConfiguration conf)
Initialize the TabletBalancer.
|
protected void |
resetBalancerErrors()
Resets logging about problems meeting an external constraint on balancing.
|
protected ServerConfiguration configuration
protected static final long TIME_BETWEEN_BALANCER_WARNINGS
public void init(ServerConfiguration conf)
public abstract void getAssignments(SortedMap<TServerInstance,TabletServerStatus> current, Map<KeyExtent,TServerInstance> unassigned, Map<KeyExtent,TServerInstance> assignments)
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.public abstract long balance(SortedMap<TServerInstance,TabletServerStatus> current, Set<KeyExtent> migrations, List<TabletMigration> migrationsOut)
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.protected void constraintNotMet(TabletBalancer.BalancerProblem cause)
protected void resetBalancerErrors()
public List<TabletStats> getOnlineTabletsForTable(TServerInstance tserver, String tableId) throws ThriftSecurityException, org.apache.thrift.TException
tserver
- The tablet server to ask.tableId
- The table idThriftSecurityException
- tablet server disapproves of your internal System password.org.apache.thrift.TException
- any other problempublic static List<TabletMigration> checkMigrationSanity(Set<TServerInstance> current, List<TabletMigration> migrations)
Copyright © 2011-2015 The Apache Software Foundation. All Rights Reserved.