protected static class BaseLoadBalancer.Cluster extends Object
Modifier and Type | Class and Description |
---|---|
static class |
BaseLoadBalancer.Cluster.Action
An action to move or swap a region
|
static class |
BaseLoadBalancer.Cluster.AssignRegionAction |
static class |
BaseLoadBalancer.Cluster.MoveRegionAction |
static class |
BaseLoadBalancer.Cluster.SwapRegionsAction |
Modifier and Type | Field and Description |
---|---|
(package private) Map<ServerName,List<HRegionInfo>> |
clusterState |
(package private) boolean |
hasRegionReplicas |
(package private) String[] |
hosts |
(package private) Map<String,Integer> |
hostsToIndex |
(package private) int[] |
initialRegionIndexToServerIndex |
private Comparator<Integer> |
localityComparator |
(package private) float[] |
localityPerServer |
(package private) boolean |
multiServersPerHost |
static BaseLoadBalancer.Cluster.Action |
NullAction |
(package private) int |
numHosts |
(package private) int[] |
numMaxRegionsPerTable |
(package private) int |
numMovedRegions |
(package private) int |
numRacks |
(package private) int |
numRegions |
private Comparator<Integer> |
numRegionsComparator |
(package private) int[][] |
numRegionsPerServerPerTable |
(package private) int |
numServers |
(package private) int |
numTables |
(package private) int[][] |
primariesOfRegionsPerHost |
(package private) int[][] |
primariesOfRegionsPerRack |
(package private) int[][] |
primariesOfRegionsPerServer |
protected RackManager |
rackManager |
(package private) String[] |
racks |
(package private) Map<String,Integer> |
racksToIndex |
private RegionLocationFinder |
regionFinder |
(package private) int[] |
regionIndexToPrimaryIndex |
(package private) int[] |
regionIndexToServerIndex |
(package private) int[] |
regionIndexToTableIndex |
(package private) Deque<RegionLoad>[] |
regionLoads |
(package private) int[][] |
regionLocations |
(package private) HRegionInfo[] |
regions |
(package private) int[][] |
regionsPerHost |
(package private) int[][] |
regionsPerRack |
(package private) int[][] |
regionsPerServer |
(package private) Map<HRegionInfo,Integer> |
regionsToIndex |
(package private) int[] |
serverIndexToHostIndex |
(package private) int[] |
serverIndexToRackIndex |
(package private) Integer[] |
serverIndicesSortedByLocality |
(package private) Integer[] |
serverIndicesSortedByRegionCount |
(package private) ServerName[] |
servers |
(package private) int[][] |
serversPerHost |
(package private) int[][] |
serversPerRack |
(package private) Map<String,Integer> |
serversToIndex |
(package private) ArrayList<String> |
tables |
(package private) Map<String,Integer> |
tablesToIndex |
Modifier | Constructor and Description |
---|---|
protected |
BaseLoadBalancer.Cluster(Collection<HRegionInfo> unassignedRegions,
Map<ServerName,List<HRegionInfo>> clusterState,
Map<String,Deque<RegionLoad>> loads,
RegionLocationFinder regionFinder,
RackManager rackManager) |
protected |
BaseLoadBalancer.Cluster(Map<ServerName,List<HRegionInfo>> clusterState,
Map<String,Deque<RegionLoad>> loads,
RegionLocationFinder regionFinder,
RackManager rackManager) |
Modifier and Type | Method and Description |
---|---|
(package private) int[] |
addRegion(int[] regions,
int regionIndex) |
(package private) int[] |
addRegionSorted(int[] regions,
int regionIndex) |
(package private) void |
calculateRegionServerLocalities() |
(package private) boolean |
contains(int[] arr,
int val) |
void |
doAction(BaseLoadBalancer.Cluster.Action action) |
(package private) void |
doAssignRegion(HRegionInfo regionInfo,
ServerName serverName) |
(package private) int |
getLeastLoadedTopServerForRegion(int region) |
(package private) float |
getLocality(int server) |
(package private) float |
getLocalityOfRegion(int region,
int server) |
(package private) int |
getLowestLocalityRegionOnServer(int serverIndex) |
(package private) int |
getLowestLocalityRegionServer() |
(package private) int |
getNumRegions(int server) |
(package private) void |
regionMoved(int region,
int oldServer,
int newServer) |
private void |
registerRegion(HRegionInfo region,
int regionIndex,
int serverIndex,
Map<String,Deque<RegionLoad>> loads,
RegionLocationFinder regionFinder)
Helper for Cluster constructor to handle a region
|
(package private) int[] |
removeRegion(int[] regions,
int regionIndex) |
(package private) int[] |
replaceRegion(int[] regions,
int regionIndex,
int newRegionIndex) |
(package private) void |
sortServersByLocality() |
(package private) void |
sortServersByRegionCount() |
String |
toString() |
(package private) boolean |
wouldLowerAvailability(HRegionInfo regionInfo,
ServerName serverName)
Return true if the placement of region on server would lower the availability
of the region in question
|
ServerName[] servers
String[] hosts
String[] racks
boolean multiServersPerHost
HRegionInfo[] regions
Deque<RegionLoad>[] regionLoads
private RegionLocationFinder regionFinder
int[][] regionLocations
int[] serverIndexToHostIndex
int[] serverIndexToRackIndex
int[][] regionsPerServer
int[][] regionsPerHost
int[][] regionsPerRack
int[][] primariesOfRegionsPerServer
int[][] primariesOfRegionsPerHost
int[][] primariesOfRegionsPerRack
int[][] serversPerHost
int[][] serversPerRack
int[] regionIndexToServerIndex
int[] initialRegionIndexToServerIndex
int[] regionIndexToTableIndex
int[][] numRegionsPerServerPerTable
int[] numMaxRegionsPerTable
int[] regionIndexToPrimaryIndex
boolean hasRegionReplicas
Integer[] serverIndicesSortedByRegionCount
Integer[] serverIndicesSortedByLocality
Map<HRegionInfo,Integer> regionsToIndex
float[] localityPerServer
int numServers
int numHosts
int numRacks
int numTables
int numRegions
int numMovedRegions
Map<ServerName,List<HRegionInfo>> clusterState
protected final RackManager rackManager
public static final BaseLoadBalancer.Cluster.Action NullAction
private Comparator<Integer> numRegionsComparator
private Comparator<Integer> localityComparator
protected BaseLoadBalancer.Cluster(Map<ServerName,List<HRegionInfo>> clusterState, Map<String,Deque<RegionLoad>> loads, RegionLocationFinder regionFinder, RackManager rackManager)
protected BaseLoadBalancer.Cluster(Collection<HRegionInfo> unassignedRegions, Map<ServerName,List<HRegionInfo>> clusterState, Map<String,Deque<RegionLoad>> loads, RegionLocationFinder regionFinder, RackManager rackManager)
private void registerRegion(HRegionInfo region, int regionIndex, int serverIndex, Map<String,Deque<RegionLoad>> loads, RegionLocationFinder regionFinder)
public void doAction(BaseLoadBalancer.Cluster.Action action)
boolean wouldLowerAvailability(HRegionInfo regionInfo, ServerName serverName)
server
- region
- void doAssignRegion(HRegionInfo regionInfo, ServerName serverName)
void regionMoved(int region, int oldServer, int newServer)
int[] removeRegion(int[] regions, int regionIndex)
int[] addRegion(int[] regions, int regionIndex)
int[] addRegionSorted(int[] regions, int regionIndex)
int[] replaceRegion(int[] regions, int regionIndex, int newRegionIndex)
void sortServersByRegionCount()
int getNumRegions(int server)
boolean contains(int[] arr, int val)
void sortServersByLocality()
float getLocality(int server)
int getLowestLocalityRegionServer()
int getLowestLocalityRegionOnServer(int serverIndex)
float getLocalityOfRegion(int region, int server)
int getLeastLoadedTopServerForRegion(int region)
void calculateRegionServerLocalities()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.