@InterfaceAudience.Private public class RSGroupAdminServer extends Object implements RSGroupAdmin
Modifier and Type | Field and Description |
---|---|
static String |
KEEP_ONE_SERVER_IN_DEFAULT_ERROR_MESSAGE |
private static org.slf4j.Logger |
LOG |
private MasterServices |
master |
private RSGroupInfoManager |
rsGroupInfoManager |
Constructor and Description |
---|
RSGroupAdminServer(MasterServices master,
RSGroupInfoManager rsGroupInfoManager) |
Modifier and Type | Method and Description |
---|---|
private void |
addRegion(LinkedList<RegionInfo> regions,
RegionInfo hri) |
void |
addRSGroup(String name)
Creates a new RegionServer group with the given name.
|
boolean |
balanceRSGroup(String groupName)
Balance regions in the given RegionServer group.
|
private void |
checkForDeadOrOnlineServers(Set<Address> servers)
Check if the set of servers are belong to dead servers list or online servers list.
|
private void |
checkOnlineServersOnly(Set<Address> servers) |
private void |
checkServersAndTables(Set<Address> servers,
Set<TableName> tables,
String targetGroupName)
Check servers and tables.
|
private RSGroupInfo |
getAndCheckRSGroupInfo(String name)
Check passed name.
|
private List<RegionInfo> |
getRegions(Address server) |
private Map<TableName,Map<ServerName,List<RegionInfo>>> |
getRSGroupAssignmentsByTable(String groupName) |
RSGroupInfo |
getRSGroupInfo(String groupName)
Gets
RSGroupInfo for given group name. |
RSGroupInfo |
getRSGroupInfoOfTable(TableName tableName)
Gets
RSGroupInfo for the given table's group. |
RSGroupInfo |
getRSGroupOfServer(Address hostPort)
Retrieve the RSGroupInfo a server is affiliated to
|
List<RSGroupInfo> |
listRSGroups()
Lists current set of RegionServer groups.
|
private void |
moveServerRegionsFromGroup(Set<Address> servers,
String targetGroupName)
Move every region from servers which are currently located on these servers,
but should not be located there.
|
void |
moveServers(Set<Address> servers,
String targetGroupName)
Move given set of servers to the specified target RegionServer group.
|
void |
moveServersAndTables(Set<Address> servers,
Set<TableName> tables,
String targetGroup)
Move given set of servers and tables to the specified target RegionServer group.
|
private void |
moveTableRegionsToGroup(Set<TableName> tables,
String targetGroupName)
Moves regions of tables which are not on target group servers.
|
void |
moveTables(Set<TableName> tables,
String targetGroup)
Move given set of tables to the specified target RegionServer group.
|
void |
removeRSGroup(String name)
Removes RegionServer group associated with the given name.
|
void |
removeServers(Set<Address> servers)
Remove decommissioned servers from rsgroup.
|
private Map<String,RegionState> |
rsGroupGetRegionsInTransition(String groupName) |
private static final org.slf4j.Logger LOG
public static final String KEEP_ONE_SERVER_IN_DEFAULT_ERROR_MESSAGE
private MasterServices master
private final RSGroupInfoManager rsGroupInfoManager
public RSGroupAdminServer(MasterServices master, RSGroupInfoManager rsGroupInfoManager)
public RSGroupInfo getRSGroupInfo(String groupName) throws IOException
RSGroupAdmin
RSGroupInfo
for given group name.getRSGroupInfo
in interface RSGroupAdmin
IOException
public RSGroupInfo getRSGroupInfoOfTable(TableName tableName) throws IOException
RSGroupAdmin
RSGroupInfo
for the given table's group.getRSGroupInfoOfTable
in interface RSGroupAdmin
IOException
private void checkOnlineServersOnly(Set<Address> servers) throws ConstraintException
ConstraintException
private RSGroupInfo getAndCheckRSGroupInfo(String name) throws IOException
name
IOException
private List<RegionInfo> getRegions(Address server)
server
.private void addRegion(LinkedList<RegionInfo> regions, RegionInfo hri)
private void checkServersAndTables(Set<Address> servers, Set<TableName> tables, String targetGroupName) throws IOException
servers
- servers to movetables
- tables to movetargetGroupName
- target group nameIOException
- if nulls or if servers and tables not belong to the same groupprivate void moveServerRegionsFromGroup(Set<Address> servers, String targetGroupName) throws IOException
servers
- the servers that will move to new grouptargetGroupName
- the target group nameIOException
- if moving the server and tables failprivate void moveTableRegionsToGroup(Set<TableName> tables, String targetGroupName) throws IOException
tables
- the tables that will move to new grouptargetGroupName
- the target group nameIOException
- if moving the region failspublic void moveServers(Set<Address> servers, String targetGroupName) throws IOException
RSGroupAdmin
moveServers
in interface RSGroupAdmin
IOException
public void moveTables(Set<TableName> tables, String targetGroup) throws IOException
RSGroupAdmin
moveTables
in interface RSGroupAdmin
IOException
public void addRSGroup(String name) throws IOException
RSGroupAdmin
addRSGroup
in interface RSGroupAdmin
IOException
public void removeRSGroup(String name) throws IOException
RSGroupAdmin
removeRSGroup
in interface RSGroupAdmin
IOException
public boolean balanceRSGroup(String groupName) throws IOException
RSGroupAdmin
balanceRSGroup
in interface RSGroupAdmin
IOException
public List<RSGroupInfo> listRSGroups() throws IOException
RSGroupAdmin
listRSGroups
in interface RSGroupAdmin
IOException
public RSGroupInfo getRSGroupOfServer(Address hostPort) throws IOException
RSGroupAdmin
getRSGroupOfServer
in interface RSGroupAdmin
hostPort
- HostPort to get RSGroupInfo forIOException
public void moveServersAndTables(Set<Address> servers, Set<TableName> tables, String targetGroup) throws IOException
RSGroupAdmin
moveServersAndTables
in interface RSGroupAdmin
servers
- set of servers to movetables
- set of tables to movetargetGroup
- the target group nameIOException
- if moving the server and tables failpublic void removeServers(Set<Address> servers) throws IOException
RSGroupAdmin
removeServers
in interface RSGroupAdmin
servers
- set of servers to removeIOException
private Map<String,RegionState> rsGroupGetRegionsInTransition(String groupName) throws IOException
IOException
private Map<TableName,Map<ServerName,List<RegionInfo>>> getRSGroupAssignmentsByTable(String groupName) throws IOException
IOException
private void checkForDeadOrOnlineServers(Set<Address> servers) throws ConstraintException
servers
- servers to removeConstraintException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.