public class HostRegexTableLoadBalancer extends TableLoadBalancer implements ConfigurationObserver
TabletBalancer.BalancerProblem, TabletBalancer.NoTservers, TabletBalancer.OutstandingMigrations
Modifier and Type | Field and Description |
---|---|
protected static String |
DEFAULT_POOL |
static String |
HOST_BALANCER_OOB_CHECK_KEY |
static String |
HOST_BALANCER_POOL_RECHECK_KEY
Deprecated.
|
static String |
HOST_BALANCER_PREFIX |
static String |
HOST_BALANCER_REGEX_MAX_MIGRATIONS_KEY |
static String |
HOST_BALANCER_REGEX_USING_IPS_KEY |
protected long |
oobCheckMillis |
configuration, context, TIME_BETWEEN_BALANCER_WARNINGS
Constructor and Description |
---|
HostRegexTableLoadBalancer() |
Modifier and Type | Method and Description |
---|---|
long |
balance(SortedMap<TServerInstance,TabletServerStatus> current,
Set<KeyExtent> migrations,
List<TabletMigration> migrationsOut)
Ask the balancer if any migrations are necessary.
|
void |
getAssignments(SortedMap<TServerInstance,TabletServerStatus> current,
Map<KeyExtent,TServerInstance> unassigned,
Map<KeyExtent,TServerInstance> assignments)
Assign tablets to tablet servers.
|
int |
getMaxConcurrentMigrations() |
protected String |
getNameFromIp(String hostIp) |
long |
getOobCheckMillis() |
protected String |
getPoolNameForTable(String tableName)
Matches table name against pool names, returns matching pool name or DEFAULT_POOL.
|
protected List<String> |
getPoolNamesForHost(String host)
Matches host against the regexes and returns the matching pool names
|
Map<String,Pattern> |
getPoolNameToRegexPattern() |
long |
getPoolRecheckMillis()
Deprecated.
|
Map<String,String> |
getTableIdToTableName() |
void |
init(ServerConfigurationFactory conf)
Initialize the TabletBalancer.
|
boolean |
isIpBasedRegex() |
protected void |
parseConfiguration(ServerConfiguration conf)
Parse configuration and extract properties
|
void |
propertiesChanged() |
void |
propertyChanged(String key) |
void |
sessionExpired() |
protected Map<String,SortedMap<TServerInstance,TabletServerStatus>> |
splitCurrentByRegex(SortedMap<TServerInstance,TabletServerStatus> current)
Group the set of current tservers by pool name.
|
String |
toString() |
getBalancerForTable, getLoadBalancerClassNameForTable, getTableOperations
checkMigrationSanity, constraintNotMet, getOnlineTabletsForTable, init, resetBalancerErrors
public static final String HOST_BALANCER_PREFIX
public static final String HOST_BALANCER_OOB_CHECK_KEY
@Deprecated public static final String HOST_BALANCER_POOL_RECHECK_KEY
public static final String HOST_BALANCER_REGEX_USING_IPS_KEY
public static final String HOST_BALANCER_REGEX_MAX_MIGRATIONS_KEY
protected static final String DEFAULT_POOL
protected long oobCheckMillis
protected Map<String,SortedMap<TServerInstance,TabletServerStatus>> splitCurrentByRegex(SortedMap<TServerInstance,TabletServerStatus> current)
current
- map of current tserversprotected List<String> getPoolNamesForHost(String host)
host
- tablet server hostprotected String getNameFromIp(String hostIp) throws UnknownHostException
UnknownHostException
protected String getPoolNameForTable(String tableName)
tableName
- name of tableprotected void parseConfiguration(ServerConfiguration conf)
conf
- server configurationpublic long getOobCheckMillis()
@Deprecated public long getPoolRecheckMillis()
public boolean isIpBasedRegex()
public int getMaxConcurrentMigrations()
public void init(ServerConfigurationFactory conf)
TabletBalancer
init
in class TabletBalancer
public void getAssignments(SortedMap<TServerInstance,TabletServerStatus> current, Map<KeyExtent,TServerInstance> unassigned, Map<KeyExtent,TServerInstance> assignments)
TabletBalancer
getAssignments
in class TableLoadBalancer
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 long balance(SortedMap<TServerInstance,TabletServerStatus> current, Set<KeyExtent> migrations, List<TabletMigration> migrationsOut)
TabletBalancer
balance
in class TableLoadBalancer
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.public void propertyChanged(String key)
propertyChanged
in interface ConfigurationObserver
public void propertiesChanged()
propertiesChanged
in interface ConfigurationObserver
public void sessionExpired()
sessionExpired
in interface ConfigurationObserver
Copyright © 2011–2018 The Apache Software Foundation. All rights reserved.