org.apache.accumulo.server.master.balancer
Class ChaoticLoadBalancer

java.lang.Object
  extended by org.apache.accumulo.server.master.balancer.TabletBalancer
      extended by org.apache.accumulo.server.master.balancer.ChaoticLoadBalancer

public class ChaoticLoadBalancer
extends TabletBalancer

A chaotic load balancer used for testing. It constantly shuffles tablets, preventing them from resting in a single location for very long. This is not designed for performance, do not use on production systems. I'm calling it the LokiLoadBalancer.


Constructor Summary
ChaoticLoadBalancer()
           
 
Method Summary
 long balance(SortedMap<TServerInstance,TabletServerStatus> current, Set<KeyExtent> migrations, List<TabletMigration> migrationsOut)
          Will balance randomly, maintaining distribution
 void getAssignments(SortedMap<TServerInstance,TabletServerStatus> current, Map<KeyExtent,TServerInstance> unassigned, Map<KeyExtent,TServerInstance> assignments)
          Assign tablets to tablet servers.
 
Methods inherited from class org.apache.accumulo.server.master.balancer.TabletBalancer
checkMigrationSanity, getOnlineTabletsForTable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChaoticLoadBalancer

public ChaoticLoadBalancer()
Method Detail

getAssignments

public void getAssignments(SortedMap<TServerInstance,TabletServerStatus> current,
                           Map<KeyExtent,TServerInstance> unassigned,
                           Map<KeyExtent,TServerInstance> assignments)
Description copied from class: TabletBalancer
Assign tablets to tablet servers. This method is called whenever the master finds tablets that are unassigned.

Specified by:
getAssignments in class TabletBalancer
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 long balance(SortedMap<TServerInstance,TabletServerStatus> current,
                    Set<KeyExtent> migrations,
                    List<TabletMigration> migrationsOut)
Will balance randomly, maintaining distribution

Specified by:
balance in class TabletBalancer
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.


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.