Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions hbase-assembly/src/main/assembly/components.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,6 @@
</includes>
<fileMode>0644</fileMode>
</fileSet>
<fileSet>
<directory>${project.basedir}/../hbase-rsgroup/target/</directory>
<outputDirectory>lib</outputDirectory>
<includes>
<include>${rsgroup.test.jar}</include>
</includes>
<fileMode>0644</fileMode>
</fileSet>
<fileSet>
<directory>${project.basedir}/../hbase-mapreduce/target/</directory>
<outputDirectory>lib</outputDirectory>
Expand Down
1 change: 0 additions & 1 deletion hbase-assembly/src/main/assembly/hadoop-two-compat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
<include>org.apache.hbase:hbase-protocol-shaded</include>
<include>org.apache.hbase:hbase-replication</include>
<include>org.apache.hbase:hbase-rest</include>
<include>org.apache.hbase:hbase-rsgroup</include>
<include>org.apache.hbase:hbase-server</include>
<include>org.apache.hbase:hbase-shell</include>
<include>org.apache.hbase:hbase-testing-util</include>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand Down Expand Up @@ -987,4 +988,9 @@ public ColumnFamilyDescriptor getColumnFamily(byte[] name) {
protected ModifyableTableDescriptor getDelegateeForModification() {
return delegatee;
}

@Override
public Optional<String> getRegionServerGroup() {
return delegatee.getRegionServerGroup();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.apache.hadoop.hbase.client.replication.TableCFs;
import org.apache.hadoop.hbase.client.security.SecurityCapability;
import org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel;
import org.apache.hadoop.hbase.net.Address;
import org.apache.hadoop.hbase.quotas.QuotaFilter;
import org.apache.hadoop.hbase.quotas.QuotaSettings;
import org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshotView;
Expand All @@ -53,6 +54,7 @@
import org.apache.hadoop.hbase.replication.ReplicationPeerConfig;
import org.apache.hadoop.hbase.replication.ReplicationPeerDescription;
import org.apache.hadoop.hbase.replication.SyncReplicationState;
import org.apache.hadoop.hbase.rsgroup.RSGroupInfo;
import org.apache.hadoop.hbase.security.access.GetUserPermissionsRequest;
import org.apache.hadoop.hbase.security.access.Permission;
import org.apache.hadoop.hbase.security.access.UserPermission;
Expand Down Expand Up @@ -2232,4 +2234,71 @@ List<Boolean> hasUserPermissions(String userName, List<Permission> permissions)
default List<Boolean> hasUserPermissions(List<Permission> permissions) throws IOException {
return hasUserPermissions(null, permissions);
}

/**
* Gets group info for the given group name
* @param groupName the group name
* @return group info
* @throws IOException if a remote or network exception occurs
*/
RSGroupInfo getRSGroupInfo(String groupName) throws IOException;

/**
* Move given set of servers to the specified target RegionServer group
* @param servers set of servers to move
* @param targetGroup the group to move servers to
* @throws IOException if a remote or network exception occurs
*/
void moveServers(Set<Address> servers, String targetGroup) throws IOException;

/**
* Creates a new RegionServer group with the given name
* @param groupName the name of the group
* @throws IOException if a remote or network exception occurs
*/
void addRSGroup(String groupName) throws IOException;

/**
* Removes RegionServer group associated with the given name
* @param groupName the group name
* @throws IOException if a remote or network exception occurs
*/
void removeRSGroup(String groupName) throws IOException;

/**
* Balance regions in the given RegionServer group
* @param groupName the group name
* @return boolean Whether balance ran or not
* @throws IOException if a remote or network exception occurs
*/
boolean balanceRSGroup(String groupName) throws IOException;

/**
* Lists current set of RegionServer groups
* @throws IOException if a remote or network exception occurs
*/
List<RSGroupInfo> listRSGroups() throws IOException;

/**
* Retrieve the RSGroupInfo a server is affiliated to
* @param hostPort HostPort to get RSGroupInfo for
* @throws IOException if a remote or network exception occurs
*/
RSGroupInfo getRSGroupOfServer(Address hostPort) throws IOException;

/**
* Remove decommissioned servers from group
* 1. Sometimes we may find the server aborted due to some hardware failure and we must offline
* the server for repairing. Or we need to move some servers to join other clusters.
* So we need to remove these servers from the group.
* 2. Dead/recovering/live servers will be disallowed.
* @param servers set of servers to remove
* @throws IOException if a remote or network exception occurs
*/
void removeServers(Set<Address> servers) throws IOException;

RSGroupInfo getRSGroupInfoOfTable(TableName tableName) throws IOException;

void setRSGroupForTables(Set<TableName> tables, String groupName) throws IOException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@
import org.apache.hadoop.hbase.client.replication.TableCFs;
import org.apache.hadoop.hbase.client.security.SecurityCapability;
import org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel;
import org.apache.hadoop.hbase.net.Address;
import org.apache.hadoop.hbase.quotas.QuotaFilter;
import org.apache.hadoop.hbase.quotas.QuotaSettings;
import org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshotView;
import org.apache.hadoop.hbase.regionserver.wal.FailedLogCloseException;
import org.apache.hadoop.hbase.replication.ReplicationPeerConfig;
import org.apache.hadoop.hbase.replication.ReplicationPeerDescription;
import org.apache.hadoop.hbase.replication.SyncReplicationState;
import org.apache.hadoop.hbase.rsgroup.RSGroupInfo;
import org.apache.hadoop.hbase.security.access.GetUserPermissionsRequest;
import org.apache.hadoop.hbase.security.access.Permission;
import org.apache.hadoop.hbase.security.access.UserPermission;
Expand Down Expand Up @@ -942,4 +944,55 @@ public List<Boolean> hasUserPermissions(String userName, List<Permission> permis
throws IOException {
return get(admin.hasUserPermissions(userName, permissions));
}

@Override
public RSGroupInfo getRSGroupInfo(String groupName) throws IOException {
return get(admin.getRSGroupInfo(groupName));
}

@Override
public void moveServers(Set<Address> servers, String targetGroup) throws IOException {
get(admin.moveServers(servers, targetGroup));
}

@Override
public void addRSGroup(String groupName) throws IOException {
get(admin.addRSGroup(groupName));
}

@Override
public void removeRSGroup(String groupName) throws IOException {
get(admin.removeRSGroup(groupName));
}

@Override
public boolean balanceRSGroup(String groupName) throws IOException {
return get(admin.balanceRSGroup(groupName));
}

@Override
public List<RSGroupInfo> listRSGroups() throws IOException {
return get(admin.listRSGroups());
}

@Override
public RSGroupInfo getRSGroupOfServer(Address hostPort) throws IOException {
return get(admin.getRSGroupOfServer(hostPort));
}

@Override
public void removeServers(Set<Address> servers) throws IOException {
get(admin.removeServers(servers));
}

@Override
public RSGroupInfo getRSGroupInfoOfTable(TableName tableName) throws IOException {
return get(admin.getRSGroupInfoOfTable(tableName));
}

@Override
public void setRSGroupForTables(Set<TableName> tables, String groupName) throws IOException {
get(admin.setRSGroupForTables(tables, groupName));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.replication.TableCFs;
import org.apache.hadoop.hbase.client.security.SecurityCapability;
import org.apache.hadoop.hbase.net.Address;
import org.apache.hadoop.hbase.quotas.QuotaFilter;
import org.apache.hadoop.hbase.quotas.QuotaSettings;
import org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshotView;
import org.apache.hadoop.hbase.replication.ReplicationPeerConfig;
import org.apache.hadoop.hbase.replication.ReplicationPeerDescription;
import org.apache.hadoop.hbase.replication.SyncReplicationState;
import org.apache.hadoop.hbase.rsgroup.RSGroupInfo;
import org.apache.hadoop.hbase.security.access.GetUserPermissionsRequest;
import org.apache.hadoop.hbase.security.access.Permission;
import org.apache.hadoop.hbase.security.access.UserPermission;
Expand Down Expand Up @@ -1381,7 +1383,7 @@ default CompletableFuture<List<ServerName>> listDeadServers() {
* @param newTableName name of the new table where the table will be created
* @param preserveSplits True if the splits should be preserved
*/
CompletableFuture<Void> cloneTableSchema(final TableName tableName,
CompletableFuture<Void> cloneTableSchema(final TableName tableName,
final TableName newTableName, final boolean preserveSplits);

/**
Expand Down Expand Up @@ -1484,4 +1486,71 @@ CompletableFuture<List<Boolean>> hasUserPermissions(String userName,
default CompletableFuture<List<Boolean>> hasUserPermissions(List<Permission> permissions) {
return hasUserPermissions(null, permissions);
}

/**
* Gets group info for the given group name
* @param groupName the group name
* @return group info
* @throws IOException if a remote or network exception occurs
*/
CompletableFuture<? extends RSGroupInfo> getRSGroupInfo(String groupName) throws IOException;

/**
* Move given set of servers to the specified target RegionServer group
* @param servers set of servers to move
* @param targetGroup the group to move servers to
* @throws IOException if a remote or network exception occurs
*/
CompletableFuture<Void> moveServers(Set<Address> servers, String targetGroup) throws IOException;

/**
* Creates a new RegionServer group with the given name
* @param groupName the name of the group
* @throws IOException if a remote or network exception occurs
*/
CompletableFuture<Void> addRSGroup(String groupName) throws IOException;

/**
* Removes RegionServer group associated with the given name
* @param groupName the group name
* @throws IOException if a remote or network exception occurs
*/
CompletableFuture<Void> removeRSGroup(String groupName) throws IOException;

/**
* Balance regions in the given RegionServer group
* @param groupName the group name
* @return boolean Whether balance ran or not
* @throws IOException if a remote or network exception occurs
*/
CompletableFuture<Boolean> balanceRSGroup(String groupName) throws IOException;

/**
* Lists current set of RegionServer groups
* @throws IOException if a remote or network exception occurs
*/
CompletableFuture<List<RSGroupInfo>> listRSGroups() throws IOException;

/**
* Retrieve the RSGroupInfo a server is affiliated to
* @param hostPort HostPort to get RSGroupInfo for
* @throws IOException if a remote or network exception occurs
*/
CompletableFuture<? extends RSGroupInfo> getRSGroupOfServer(Address hostPort) throws IOException;

/**
* Remove decommissioned servers from group
* 1. Sometimes we may find the server aborted due to some hardware failure and we must offline
* the server for repairing. Or we need to move some servers to join other clusters.
* So we need to remove these servers from the group.
* 2. Dead/recovering/live servers will be disallowed.
* @param servers set of servers to remove
* @throws IOException if a remote or network exception occurs
*/
CompletableFuture<Void> removeServers(Set<Address> servers) throws IOException;

CompletableFuture<RSGroupInfo> getRSGroupInfoOfTable(TableName tableName) throws IOException;

CompletableFuture<Void> setRSGroupForTables(Set<TableName> tables, String groupName) throws IOException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.hadoop.hbase.client;

import com.google.protobuf.RpcChannel;
import java.io.IOException;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
Expand All @@ -36,12 +37,14 @@
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.replication.TableCFs;
import org.apache.hadoop.hbase.client.security.SecurityCapability;
import org.apache.hadoop.hbase.net.Address;
import org.apache.hadoop.hbase.quotas.QuotaFilter;
import org.apache.hadoop.hbase.quotas.QuotaSettings;
import org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshot;
import org.apache.hadoop.hbase.replication.ReplicationPeerConfig;
import org.apache.hadoop.hbase.replication.ReplicationPeerDescription;
import org.apache.hadoop.hbase.replication.SyncReplicationState;
import org.apache.hadoop.hbase.rsgroup.RSGroupInfo;
import org.apache.hadoop.hbase.security.access.GetUserPermissionsRequest;
import org.apache.hadoop.hbase.security.access.Permission;
import org.apache.hadoop.hbase.security.access.UserPermission;
Expand Down Expand Up @@ -826,4 +829,55 @@ public CompletableFuture<List<Boolean>> hasUserPermissions(String userName,
List<Permission> permissions) {
return wrap(rawAdmin.hasUserPermissions(userName, permissions));
}

@Override
public CompletableFuture<? extends RSGroupInfo> getRSGroupInfo(String groupName) {
return wrap(rawAdmin.getRSGroupInfo(groupName));
}

@Override
public CompletableFuture<Void> moveServers(Set<Address> servers, String targetGroup) {
return wrap(rawAdmin.moveServers(servers, targetGroup));
}

@Override
public CompletableFuture<Void> addRSGroup(String groupName) {
return wrap(rawAdmin.addRSGroup(groupName));
}

@Override
public CompletableFuture<Void> removeRSGroup(String groupName) {
return wrap(rawAdmin.removeRSGroup(groupName));
}

@Override
public CompletableFuture<Boolean> balanceRSGroup(String groupName) {
return wrap(rawAdmin.balanceRSGroup(groupName));
}

@Override
public CompletableFuture<List<RSGroupInfo>> listRSGroups() {
return wrap(rawAdmin.listRSGroups());
}

@Override
public CompletableFuture<? extends RSGroupInfo> getRSGroupOfServer(Address hostPort) {
return wrap(rawAdmin.getRSGroupOfServer(hostPort));
}

@Override
public CompletableFuture<Void> removeServers(Set<Address> servers) {
return wrap(rawAdmin.removeServers(servers));
}

@Override
public CompletableFuture<RSGroupInfo> getRSGroupInfoOfTable(TableName tableName) {
return wrap(rawAdmin.getRSGroupInfoOfTable(tableName));
}

@Override
public CompletableFuture<Void> setRSGroupForTables(Set<TableName> tables, String groupName) {
return wrap(rawAdmin.setRSGroupForTables(tables, groupName));
}

}
Loading