org.apache.hadoop.hbase.master.balancer
Class FavoredNodesPlan

java.lang.Object
  extended by org.apache.hadoop.hbase.master.balancer.FavoredNodesPlan

@InterfaceAudience.Private
public class FavoredNodesPlan
extends Object

This class contains the mapping information between each region and its favored region server list. Used by FavoredNodeLoadBalancer set of classes and from unit tests (hence the class is public) All the access to this class is thread-safe.


Nested Class Summary
static class FavoredNodesPlan.Position
           
 
Field Summary
protected static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
FavoredNodesPlan()
           
 
Method Summary
 boolean equals(Object o)
           
 Map<HRegionInfo,List<ServerName>> getAssignmentMap()
           
 List<ServerName> getFavoredNodes(HRegionInfo region)
           
static FavoredNodesPlan.Position getFavoredServerPosition(List<ServerName> favoredNodes, ServerName server)
          Return the position of the server in the favoredNodes list.
 int hashCode()
           
 void updateAssignmentPlan(HRegionInfo region, List<ServerName> servers)
          Add an assignment to the plan
 void updateFavoredNodesMap(HRegionInfo region, List<ServerName> servers)
          Add an assignment to the plan
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG
Constructor Detail

FavoredNodesPlan

public FavoredNodesPlan()
Method Detail

updateFavoredNodesMap

public void updateFavoredNodesMap(HRegionInfo region,
                                  List<ServerName> servers)
Add an assignment to the plan

Parameters:
region -
servers -

getFavoredNodes

public List<ServerName> getFavoredNodes(HRegionInfo region)
Parameters:
region -
Returns:
the list of favored region server for this region based on the plan

getFavoredServerPosition

public static FavoredNodesPlan.Position getFavoredServerPosition(List<ServerName> favoredNodes,
                                                                 ServerName server)
Return the position of the server in the favoredNodes list. Assumes the favoredNodes list is of size 3.

Parameters:
favoredNodes -
server -
Returns:
position

getAssignmentMap

public Map<HRegionInfo,List<ServerName>> getAssignmentMap()
Returns:
the mapping between each region to its favored region server list

updateAssignmentPlan

public void updateAssignmentPlan(HRegionInfo region,
                                 List<ServerName> servers)
Add an assignment to the plan

Parameters:
region -
servers -

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2015 The Apache Software Foundation. All rights reserved.