@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.
|
BalanceResponse |
balanceRSGroup(String groupName,
BalanceRequest request)
Balance regions in the given RegionServer group, running based on the given
BalanceRequest. |
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 Address |
getRegionAddress(RegionInfo hri) |
private List<RegionInfo> |
getRegions(Address server)
Returns List of Regions associated with this
server. |
(package private) Map<TableName,Map<ServerName,List<RegionInfo>>> |
getRSGroupAssignmentsByTable(TableStateManager tableStateManager,
String groupName)
This is an EXPENSIVE clone.
|
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.
|
(package private) void |
modifyOrMoveTables(Set<TableName> tables,
RSGroupInfo targetGroup) |
private List<Long> |
modifyTables(Set<TableDescriptor> tableDescriptors,
String targetGroup) |
private void |
modifyTablesAndWaitForCompletion(Set<TableDescriptor> tableDescriptors,
String targetGroup) |
private void |
moveServerRegionsFromGroup(Set<Address> movedServers,
Set<TableName> movedTables,
Set<Address> srcGrpServers,
String targetGroupName,
String sourceGroupName)
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,
RSGroupInfo targetGrp)
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.
|
void |
renameRSGroup(String oldName,
String newName)
Rename rsgroup.
|
private Map<String,RegionState> |
rsGroupGetRegionsInTransition(String groupName) |
void |
updateConfiguration(String groupName)
Because the
RSGroupAdminClient.updateConfiguration(String) calls
Admin.updateConfiguration(ServerName) method, the
implementation of this method on the Server side is empty. |
void |
updateRSGroupConfig(String groupName,
Map<String,String> configuration)
Update RSGroup configuration
|
private void |
waitForProcedureCompletion(List<Long> procIds) |
private boolean |
waitForRegionMovement(List<Pair<RegionInfo,Future<byte[]>>> regionMoveFutures,
String groupName,
int retryCount)
Wait for all the region move to complete.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbalanceRSGroupprivate 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
RSGroupAdminRSGroupInfo for given group name.getRSGroupInfo in interface RSGroupAdminIOExceptionpublic RSGroupInfo getRSGroupInfoOfTable(TableName tableName) throws IOException
RSGroupAdminRSGroupInfo for the given table's group.getRSGroupInfoOfTable in interface RSGroupAdminIOExceptionprivate void checkOnlineServersOnly(Set<Address> servers) throws ConstraintException
ConstraintExceptionprivate RSGroupInfo getAndCheckRSGroupInfo(String name) throws IOException
nameIOExceptionprivate 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> movedServers, Set<TableName> movedTables, Set<Address> srcGrpServers, String targetGroupName, String sourceGroupName) throws IOException
movedServers - the servers that are moved to new groupmovedTables - the tables that are moved to new groupsrcGrpServers - all servers in the source group, excluding the movedServerstargetGroupName - the target groupsourceGroupName - the source groupIOException - if any error while moving regionsprivate Address getRegionAddress(RegionInfo hri)
private boolean waitForRegionMovement(List<Pair<RegionInfo,Future<byte[]>>> regionMoveFutures, String groupName, int retryCount)
private void moveTableRegionsToGroup(Set<TableName> tables, RSGroupInfo targetGrp) throws IOException
tables - the tables that will move to new grouptargetGrp - the target groupIOException - if moving the region failspublic void moveServers(Set<Address> servers, String targetGroupName) throws IOException
RSGroupAdminmoveServers in interface RSGroupAdminIOExceptionpublic void moveTables(Set<TableName> tables, String targetGroup) throws IOException
RSGroupAdminmoveTables in interface RSGroupAdminIOExceptionpublic void addRSGroup(String name) throws IOException
RSGroupAdminaddRSGroup in interface RSGroupAdminIOExceptionpublic void removeRSGroup(String name) throws IOException
RSGroupAdminremoveRSGroup in interface RSGroupAdminIOExceptionpublic BalanceResponse balanceRSGroup(String groupName, BalanceRequest request) throws IOException
RSGroupAdminBalanceRequest.balanceRSGroup in interface RSGroupAdminIOExceptionpublic List<RSGroupInfo> listRSGroups() throws IOException
RSGroupAdminlistRSGroups in interface RSGroupAdminIOExceptionpublic RSGroupInfo getRSGroupOfServer(Address hostPort) throws IOException
RSGroupAdmingetRSGroupOfServer in interface RSGroupAdminhostPort - HostPort to get RSGroupInfo forIOExceptionpublic void moveServersAndTables(Set<Address> servers, Set<TableName> tables, String targetGroup) throws IOException
RSGroupAdminmoveServersAndTables in interface RSGroupAdminservers - 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
RSGroupAdminremoveServers in interface RSGroupAdminservers - set of servers to removeIOExceptionpublic void renameRSGroup(String oldName, String newName) throws IOException
RSGroupAdminrenameRSGroup in interface RSGroupAdminoldName - old rsgroup namenewName - new rsgroup nameIOExceptionpublic void updateRSGroupConfig(String groupName, Map<String,String> configuration) throws IOException
RSGroupAdminupdateRSGroupConfig in interface RSGroupAdmingroupName - the group nameconfiguration - new configuration of the group name to be setIOException - if a remote or network exception occurspublic void updateConfiguration(String groupName) throws IOException
RSGroupAdminClient.updateConfiguration(String) calls
Admin.updateConfiguration(ServerName) method, the
implementation of this method on the Server side is empty.updateConfiguration in interface RSGroupAdmingroupName - the group nameIOException - if a remote or network exception occursprivate Map<String,RegionState> rsGroupGetRegionsInTransition(String groupName) throws IOException
IOExceptionMap<TableName,Map<ServerName,List<RegionInfo>>> getRSGroupAssignmentsByTable(TableStateManager tableStateManager, String groupName) throws IOException
balanceRSGroup(java.lang.String, org.apache.hadoop.hbase.client.BalanceRequest)IOExceptionprivate void checkForDeadOrOnlineServers(Set<Address> servers) throws ConstraintException
servers - servers to removeConstraintExceptionvoid modifyOrMoveTables(Set<TableName> tables, RSGroupInfo targetGroup) throws IOException
IOExceptionprivate void modifyTablesAndWaitForCompletion(Set<TableDescriptor> tableDescriptors, String targetGroup) throws IOException
IOExceptionprivate List<Long> modifyTables(Set<TableDescriptor> tableDescriptors, String targetGroup) throws IOException
IOExceptionprivate void waitForProcedureCompletion(List<Long> procIds) throws IOException
IOExceptionCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.